Hi Uwe :)

Thank you for your answer ! Now I have another problem. Here is the code I use to query the index :

ScoreDoc[] hits = null;
TopFieldCollector collector = TopFieldCollector.create(new Sort(SortField.FIELD_DOC), 200000, true, false, false, false); Directory directory = FSDirectory.open(new File("/home/user/index"));

        IndexSearcher isearcher = new IndexSearcher(directory);
        Query tQueryCode = new TermQuery(new Term(FIELD_CODE, "CCOM"));
Query tQueryCodeRef = new TermQuery(new Term(FIELD_CODE_REF, "CCOM")); Query rQuery = new TermRangeQuery(FIELD_ARTICLE, "l110-1", "l146-4", true, true);

        BooleanQuery bQuery = new BooleanQuery();
        bQuery.add(tQueryCode, Occur.MUST);
        bQuery.add(tQueryCodeRef, Occur.MUST);
        bQuery.add(rQuery, Occur.MUST);

        System.out.println(bQuery.toString());

        isearcher.search(bQuery, collector);
        hits = collector.topDocs().scoreDocs;

        System.out.println(hits.length);

The query is : +code:CCOM +codeRef:CCOM +article:[l110-1 TO l146-4]

The hits[] is equal to Zero although there should be hits. I'm using a program called lukeall 3.1 which provide a GUI to query a lucene index. When I copy the query into this program and run it, it return a lot of results =o

So I guess I'm missing something. I thought about a missing analyzer but I'm not sure...

Regards,
Gary

Le 17/05/2011 14:02, Uwe Schindler a écrit :
Hi,

Query q = new TermRangeQuery(...)

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to