|
[
Permlink
| « Hide
]
Shay Banon added a comment - 14/May/07 12:39 PM
There is an option to do it with CompassQueryBuilder since CompassQuerySpanNearBuilder has a method called: CompassQuerySpanNearBuilder add(CompassSpanQuery query);. In such cases, the resource property name is irrelevant and discarded. Not the nicest way (my bad), but it should work.
Yes but this only gets you so far: span near queries match when the terms are near each other, but say nothing about the terms' relative position in the field: that is why a span first query is also needed.
If you look at the code block in the initial description, using CompassQueryBuilder#spanNear would give you an equivalent to the "near" query object in the penultimate line, but you still need a span first which ties it to the start of the field! Actually I just re-read my initial description and there is a mistake: underneath the code block I mention "CompassQueryBuilder#startsWith" when I actually mean "CompassQueryBuilder#spanFirst". Makes perfect sense and an oversight on my part.
|
|||||||||||||||||||||||||||||||||||||||