You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ahmet Aksoy <ah...@axtelsoft.com> on 2005/10/05 21:43:41 UTC

Query returns an empty result set; but it is not empty actually!

Hi,
I have a dictionary. It is indexed as follows:

    private Document buildDocument(SozlukBirimi birim){
        Document doc = new Document();
        doc.add(Field.Keyword("soz", birim.getSoz()));
        doc.add(Field.Text("soz1", birim.getSoz()));
        doc.add(Field.Text("anlam", birim.getAnlam()));
        return doc;
    }

And my query is defined as:

    public List gelismisAnlamAra(String sorgu) throws ParseException
    {
        if(sorgu==null || sorgu.length()<2)
          return Collections.EMPTY_LIST;
        try
        {
            IndexSearcher searcher = new 
IndexSearcher(Indeksleyici.getRootDir()+Indeksleyici.INDEX_ROOT);
            Query q = QueryParser.parse(sorgu, "anlam", new 
TurkishAnalyser());
            Hits hits = searcher.search(q);
            return sonuclariIsle(hits);
        } catch (IOException e)
        {
            e.printStackTrace();
            return Collections.EMPTY_LIST;
        }
    }

TurkishAnalyzer is very simple!

public class TurkishAnalyser extends StandardAnalyzer
{
    private static Set _stopTable;

    public static final String[] STOP_WORDS =
            {
            ",", "$", ";", "-", ".",":"
            };
}

Some single Turkish words "menteşe", "eczane", "menekşe" returns an 
empty list for the query.
However, when a "*", or a "?" appended at the end of the query string, 
it returns the actual words in the result set.
What might the reason for that problem?
IMHO, Turkish characters do not have an affect on the problem. For 
example in "eczane" there is no special Turkish characters, but it has 
the same problem.

Ahmet Aksoy


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