Hello Ian, I am using version 4.1
I am expecting id of SearchedText which is similar of QueryStr but i am getting 0 size ScoreDoc[] hits Below is code I am using. ___________________________ My Parameter is ArrayList whic contain DocID and Criteria Text (collection of Documents to be passed for indexing) Query text in QueryStr . StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_41); // 1. create the index Directory index = new RAMDirectory(); IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_41, analyzer); IndexWriter w = new IndexWriter(index, config); int counter = 0; while (counter < lstDocBean.size()) { String searchedText=lstDocBean.getText(); String docID=lstDocBean.getDocID(); Document doc = new Document(); doc.add(new TextField("DocID", docID, shouldStore.YES)); doc.add(new TextField("searchedText", searchedText, shouldStore.YES)); w.addDocument(doc); counter++; } w.close(); int hitsperpage = 10; IndexReader reader = IndexReader.open(index); IndexSearcher searcher = new IndexSearcher(reader); // get similar doc // Reader sReader = new StringReader(); MoreLikeThis mlt = new MoreLikeThis(reader); // ------------------------ mlt.setAnalyzer(analyzer); mlt.setFieldNames("SearchedText"); Reader reader1 = new StringReader(queryStr); Query Searchedquery = mlt.like(reader1, null); // ------------------ TopDocs results = searcher.search(Searchedquery, 10); ScoreDoc[] hits = results.scoreDocs; for (int i = 0; i < hits.length; ++i) { int docId = hits[i].doc; // Document d = searcher.doc(docId); int sys_DocID=d.get("DocID"); double Score = hits[i].score } On Fri, Jul 18, 2014 at 7:34 PM, Ian Lea <ian....@gmail.com> wrote: > You need to supply more info. Tell us what version of lucene you are > using and provide a very small completely self-contained example or > test case showing exactly what you expect to happen and what is > happening instead. > > > -- > Ian. > > > On Fri, Jul 18, 2014 at 11:50 AM, Rajendra Rao > <rajendra....@launchship.com> wrote: > > Hello > > > > > > I am using more like this query .But size of Score Docs i am getting is 0 > > I found that it > > In Query Searchedquery = mlt.like(reader1, "criteria"); > > > > query object contain following value > > boost 1.0 > > all clauses element data is null > > > > > > I used following code > > MoreLikeThis mlt = new MoreLikeThis(reader); > > // ------------------------ > > mlt.setAnalyzer(analyzer); > > > > Reader reader1 = new StringReader(Requirement); > > Query Searchedquery = mlt.like(reader1, "criteria"); > > > > > > please guide me. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >