You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "ani8570 (via GitHub)" <gi...@apache.org> on 2024/12/11 08:43:14 UTC

[I] Discrepancy in Search Results with spanNearQuery [lucene]

ani8570 opened a new issue, #14056:
URL: https://github.com/apache/lucene/issues/14056

   ### Description
   
   Hello,
   I'm contacting you to confirm a discrepancy I've found while using SpanNearQuery.
   
   When searching for "applepie bananapie", it doesn't find results in files indexed as "apple pie banana pie"
   When analyzing "applepie bananapie":
   apple:PositionIncrementAttribute.setPositionIncrement(1)
   pie:PositionIncrementAttribute.setPositionIncrement(0)
   banana:PositionIncrementAttribute.setPositionIncrement(1)
   pie:PositionIncrementAttribute.setPositionIncrement(0)
   Then searching with inorder spanNear(apple, pie, banana, pie)
   3. Expected normal search results for all values below the default of 21
   4. No results output
   5. Debugging results show:
   
   ```
   @Override public int endPosition() { 
   return (position == -1) ? -1 : (position != NO_MORE_POSITIONS) ? position + 1 : NO_MORE_POSITIONS; 
   }
   ```
   The search stops due to position + 1, resulting in no search results
   
   I'm wondering if there's a special reason for including position + 1. If not, it seems it would be better to remove the "+1" part.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [I] Discrepancy in Search Results with spanNearQuery [lucene]

Posted by "ludicrousdisplay (via GitHub)" <gi...@apache.org>.
ludicrousdisplay commented on issue #14056:
URL: https://github.com/apache/lucene/issues/14056#issuecomment-2535465658

   My understanding of the SpanQuery API is that in the example you provide it will be looking for exact matches of the "applepie" token next to the "bananapie" token. Therefore the separate tokens "apple" and "pie" will not match the first query term "applepie". 
   
   Since span queries can be nested you could break each search term "applepie" and "bananapie" into a pair of tokens ("apple", "pie) and create each as a SpanNearQuery, then combine them into another one. 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [I] Discrepancy in Search Results with spanNearQuery [lucene]

Posted by "ani8570 (via GitHub)" <gi...@apache.org>.
ani8570 commented on issue #14056:
URL: https://github.com/apache/lucene/issues/14056#issuecomment-2535705551

   Hello,
   
   Previously, we attempted the following searches:
   
   1. applepie bananapie
   
   
   2. apple pie banana pie
   
   
   
   using inorder spanNear(apple pie banana pie), but document 1 was not retrieved.
   
   In document 1, for applepie,
   
   apple has posIncre:1
   
   pie has posIncre:0
   
   
   This lack of position increment prevents it from being retrieved.
   
   Even searching with spanNear(apple,pie) and spanNear(banana,pie) yields no results.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org