You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "LT.thomas" <t....@itspree.pl> on 2011/11/03 19:11:53 UTC

Ordered proximity search

Hi,

By ordered I mean term1 will always come before term2 in the document.

I have two documents:
1. "By ordered I mean term1 will always come before term2 in the document"
2. "By ordered I mean term2 will always come before term1 in the document"

if I make the query:

"term1 term2"~Integer.MAX_VALUE

my results is: 2 documents

How can I query to have one result (only if term1 come before term2): 
"By ordered I mean term1 will always come before term2 in the document"

Thanks

--
View this message in context: http://lucene.472066.n3.nabble.com/Ordered-proximity-search-tp3477946p3477946.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Ordered proximity search

Posted by "LT.thomas" <t....@itspree.pl>.
Thanks for your reply, I will check this advice

--
View this message in context: http://lucene.472066.n3.nabble.com/Ordered-proximity-search-tp3477946p3480321.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Ordered proximity search

Posted by Rahul Warawdekar <ra...@gmail.com>.
Hi Thomas,

Do you always need the ordered proximity search by default ?
You may want to check SpanNearQuery at "
http://www.lucidimagination.com/blog/2009/07/18/the-spanquery/".

We are using edismax query parser provided by Solr.
I had a similar type of requirement in our project in here is how we
addressed it

1. Wrote a customized query parser similar to edismax.
2. Identified the method in the code which takes care of "PhraseQuery" and
replaced it with a snippet of "SpanNearQuery" code.

Please check more on SpanNearQuery if that works for you.



On Thu, Nov 3, 2011 at 2:11 PM, LT.thomas <t....@itspree.pl> wrote:

> Hi,
>
> By ordered I mean term1 will always come before term2 in the document.
>
> I have two documents:
> 1. "By ordered I mean term1 will always come before term2 in the document"
> 2. "By ordered I mean term2 will always come before term1 in the document"
>
> if I make the query:
>
> "term1 term2"~Integer.MAX_VALUE
>
> my results is: 2 documents
>
> How can I query to have one result (only if term1 come before term2):
> "By ordered I mean term1 will always come before term2 in the document"
>
> Thanks
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Ordered-proximity-search-tp3477946p3477946.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Thanks and Regards
Rahul A. Warawdekar