开发者

Zend Lucene Lexicographical Range Search Returning Non-Relevant Results

开发者 https://www.devze.com 2023-01-26 03:12 出处:网络
I am using Zend Lucene to build a search feature for my website. All well and good. Understanding that Lucene does searches lexicographically (e.g.

I am using Zend Lucene to build a search feature for my website. All well and good.

Understanding that Lucene does searches lexicographically (e.g.

1,

110,

1111444,

2,

开发者_Go百科 3,

4,

499238492834798,

5,

etc)

I have padded my numbers to 3 digits (ranging from 010 to 990).

When I do a range search for values 110 to 160 (e.g. fieldname:[110 TO 160])it is returning results for 040! Logically this is wrong as all the numbers would start with a 1 (although it would still search for 11, 12, 13, 14, 15 and 16) so it should not match this result!

Why is this happening, and how do I stop it from doing so?

[edit] I misread the Zend Documentation. The Range Query that sorts results lexicographically. But my problem persists.


I am unable to find out why this is acting like this, so I'm doing a loop:

for ($i = 0; $i < 50; $i + 10)
{
 $queryString .= 'fieldname:' . ($term + $i) . ' ';
}

creates a query such as:

fieldname:110 fieldname:120 fieldname:130 fieldname:140 fieldname:150 fieldname:160

which does return the results I want exactly.

0

精彩评论

暂无评论...
验证码 换一张
取 消