Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

am trying to implement a LuceneIndex into a project of mine. First basic implementations worked fine and my methods returns the searched results

Now, I tried to store and documents in the index like this..

doc.add(new StringField("uriNote", note.getUri(), Field.Store.YES));
doc.add(new StringField("uriPatient", note.getPatientUri(), Field.Store.YES));
doc.add(new TextField("text", note.getText(), Field.Store.YES));

What I now want to do is to search through the index by a query which says.. must exact have this PatientUri and have some keywords in the text..

I'm trying this..

String queryString  = "uriPatient:" + request.getPatientUri() + " AND text:" + request.getSearchString();
        Query query = new QueryParser(Version.LUCENE_43, "text",analyzer).parse(queryString);

        int hitsPerPage = 10;

        this.searcher = new IndexSearcher(this.reader);
        TopScoreDocCollector collector = TopScoreDocCollector.create(hitsPerPage, true);
        searcher.search(query, collector);
        ScoreDoc[] hits = collector.topDocs().scoreDocs;

It seems like Lucene troubles with parsing the URL..

Any Ideas to fix that ? ^^

Thanks in forcast..

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.