--- On Wed, 10/26/11, darul <daru...@gmail.com> wrote:

> From: darul <daru...@gmail.com>
> Subject: Get results ordered by field content starting with specific word
> To: solr-user@lucene.apache.org
> Date: Wednesday, October 26, 2011, 11:36 PM
> I have seen many threads talking
> about it but not found any way on how to
> resolve it.
> 
> In my schema 2 fields :
> 
> 
> 
> Results are sorted by field2 desc like in the following
> listing when looking
> for "word1" as query pattern:
> 
> 
> 
> I would like to get Doc3 at the end because "word1" is not
> at the beginning
> of the field content.
> 
> Have you any idea ? 
> 
> I have seen SpanNearQuery, tried FuzzySearch with no
> success etc...maybe
> making a special QueryParserPlugin, but I am lost ;)

May be you can make use of SpanFirstQuery.

http://lucene.apache.org/java/3_1_0/api/core/org/apache/lucene/search/spans/SpanFirstQuery.html

However, I would insert an artificial token (e.g. BEGIN_OF_DOC) before indexing 
my fields. And use a phrase query or something to boost documents starts with 
word1. e.g. "BEGIN_OF_DOC word1"


Reply via email to