Alessandro Pasotti
2008-May-19 08:52 UTC
[Xapian-discuss] how to retrieve filtering a single value ?
Hello, I'm trying to retrieve data filtering by a single value but I've found only OP_VALUE_GE OP_VALUE_LE OP_VALUE_RANGE Am I missing something or there is nothing like OP_VALUE_EQ ? Should I use range "12..12" to retrieve docs where value is 12? -- Alessandro Pasotti w3: www.itopen.it
Richard Boulton
2008-May-19 09:20 UTC
[Xapian-discuss] how to retrieve filtering a single value ?
Alessandro Pasotti wrote:> I'm trying to retrieve data filtering by a single value but I've found only > OP_VALUE_GE > OP_VALUE_LE > OP_VALUE_RANGE > > Am I missing something or there is nothing like OP_VALUE_EQ ?There is no OP_VALUE_EQ type operator at present.> Should I use range "12..12" to retrieve docs where value is 12?That will work, and is sometimes the right thing to do. It's possible we should add an OP_VALUE_EQ, but for now the overhead of using OP_VALUE_RANGE instead should be minimal. However, often, if you find yourself wanting to filter by a single value, it will actually be much quicker (at search time) to store a term instead of a value at index time, and use that term instead of an OP_VALUE_EQ. For example, you'd might use the prefix "XV" for this term, so you'd store "XV12" in this case, and then use OP_FILTER to restrict your search results to only those documents containing "XV12". -- Richard