Thank you James . I will try to contribute :)<br><br><div class="gmail_quote">On Mon, Oct 8, 2012 at 1:27 PM, James Aylett <span dir="ltr"><<a href="mailto:james-xapian@tartarus.org" target="_blank">james-xapian@tartarus.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Your expectations may be confounded :-)<br>
<br>
Lucene and Xapian are sufficiently different that for many user-facing features you may have to tackle the problem in a totally different way. Additionally, auto complete can be used to do a number of different things, so without you saying what you're actually trying to achieve it's difficult to be certain how to advise you.<br>
<br>
What I thought you initially asked for (and which matches my understanding of using edge n-grams) was a way of expanding partial terms, presumably at the end of a typed search string, to complete terms. This is what FLAG_PARTIAL is for (although it's not always that simple, particularly with auto complete, as you may have to read the generated Query object to figure out the options for completion to display).<br>
<br>
Your explanation of edge n-grams in Lucene seems to be using words as the particles, which you could use to auto complete the titles for instance – although for that you're probably better off using a left substring search against a relational database, or something similar.<br>
<br>
To answer your direct questions – 1) no, although if you needed it the thing to do would be to write your own TermGenerator and probably QueryParser. 2) there are some more examples in the new documentation, but basically if there's something that isn't documented it's because nobody's gotten around to documenting it yet. The API itself is reasonably well-documented, so if you find somewhere that you feel should have an additional topic document, please feel free to contribute!<br>
<span class="HOEnZb"><font color="#888888"><br>
James<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 8 Oct 2012, at 03:08, Naveen A.N. <<a href="mailto:naveen@searchlabs.org">naveen@searchlabs.org</a>> wrote:<br>
<br>
> Hello James,<br>
> The thing is the code works perfectly but that is not the way that auto completion work.I am basically from JAVA lucene and i am sure that lucene and xapian are different but i expect that all the features are same.<br>
> In lucene we index the document using Edge N gram analyzer .so the document "xapian is search engine " will be generated as "xapian","xapian is ","xapian is search","xapian is search engine". But in my code in xapian how it works is it gives only the "xapian is search engine". And i am sure that you are aware of how auto completion works.<br>
><br>
> I have the below questions.<br>
> 1) Do xapian has Edge N gram analyzer or similar thing?<br>
> 2) why there is only examples for basic indexing and searching ?But not for important features like facets and filtering, auto completion etc.<br>
> only snippets are available.Do you have some working example of facets,filters in c++? If i missed the links can you provide them?<br>
><br>
> On Sun, Oct 7, 2012 at 11:34 PM, James Aylett <<a href="mailto:james-xapian@tartarus.org">james-xapian@tartarus.org</a>> wrote:<br>
> I'm not sure I understand. You have code that works, and you are using FLAG_PARTIAL the way it is documented. Why are you not sure that what you're doing is correct? Is there something about the documentation that is confusing, or missing? Obviously we'd like to improve things wherever possible to avoid other people being uncertain in future.<br>
><br>
> There's nothing about the code I can see that looks wrong, although it's been a while since I regularly read C++ so I might be missing something obvious.<br>
><br>
> James<br>
><br>
> On 7 Oct 2012, at 18:16, Naveen A.N. <<a href="mailto:naveen@searchlabs.org">naveen@searchlabs.org</a>> wrote:<br>
><br>
> > Hello James,<br>
> ><br>
> > Thank you for your reply,<br>
> > I tried using the below code.As you said it matches the partial query if i remove the * but the thing is i am not sure is this the correct way to generate the auto completion. Can u tell me how can i generate the auto completion ? Or give me an example?<br>
> ><br>
> > #include <xapian.h><br>
> > #include <iostream><br>
> > #include <string><br>
> > #include <cstdlib> // For exit().<br>
> > #include <cstring><br>
> ><br>
> > using namespace std;<br>
> ><br>
> > int main(int argc, char **argv)<br>
> > try {<br>
> ><br>
> > Xapian::WritableDatabase db("/home/example/xapian",<br>
> > Xapian::DB_CREATE_OR_OPEN);<br>
> > Xapian::TermGenerator indexer;<br>
> > Xapian::Stem stemmer("english");<br>
> > indexer.set_stemmer(stemmer);<br>
> > indexer.set_database(db);<br>
> > indexer.set_flags(indexer.FLAG_SPELLING);<br>
> > string para = "master of business administration master in c++ ";<br>
> > Xapian::Document doc;<br>
> > doc.set_data(para);<br>
> > indexer.set_document(doc);<br>
> > indexer.index_text(para);<br>
> > db.add_document(doc);<br>
> > db.commit();<br>
> > Xapian::QueryParser parser;<br>
> > parser.set_database(db);<br>
> > parser.set_default_op(Xapian::Query::OP_AND);<br>
> > parser.set_stemmer(stemmer);<br>
> > parser.set_stemming_strategy(Xapian::QueryParser::STEM_SOME);<br>
> > Xapian::Query query = parser.parse_query("master",<br>
> > parser.FLAG_DEFAULT | parser.FLAG_SPELLING_CORRECTION<br>
> > | parser.FLAG_AUTO_SYNONYMS | parser.FLAG_PARTIAL);<br>
> > Xapian::Enquire enquire(db);<br>
> > enquire.set_query(query);<br>
> > Xapian::MSet mset = enquire.get_mset(0, 10);<br>
> ><br>
> > for (Xapian::MSetIterator i = mset.begin(); i != mset.end(); i++) {<br>
> > Xapian::Document doc = i.get_document();<br>
> > string data = doc.get_data();<br>
> > cout << *i << ": [" << i.get_weight() << "]\n" << data << "\n";<br>
> > }<br>
> > cout << flush;<br>
> > }<br>
> > catch (const Xapian::Error &e) {<br>
> > cout << e.get_description() << endl;<br>
> > exit(1);<br>
> > }<br>
> ><br>
> ><br>
> > On Sun, Oct 7, 2012 at 10:13 PM, James Aylett <<a href="mailto:james-xapian@tartarus.org">james-xapian@tartarus.org</a>> wrote:<br>
> > A query string such as "m*" is using the wildcard expansion operator – if you want to use the partial support, you don't want the * at the end of your query string.<br>
> ><br>
> > It's also not clear from your message whether you've set a database before trying to parse your query. You need to do this, because Xapian's wildcard support (which is what partial uses) is done at query time, expanding to all the possibly matching terms, rather than at index time in an n-gram analyzer style.<br>
> ><br>
> > If you still can't get this to work, try posting a complete program rather than just a snippet.<br>
> ><br>
> > James<br>
> ><br>
> ><br>
> > On 4 Oct 2012, at 18:20, Naveen A.N. <<a href="mailto:naveen@searchlabs.org">naveen@searchlabs.org</a>> wrote:<br>
> ><br>
> > > Hello,<br>
> > ><br>
> > > Do xapian has analyzer like EdgeNGram to use it for autocomplete.<br>
> > ><br>
> > > I am trying to use the auto completion using xapian.<br>
> > > For example:<br>
> > > e<br>
> > > ex<br>
> > > exa<br>
> > > exam<br>
> > > example<br>
> > > etc..<br>
> > > so that we can get it.<br>
> > > I tried to use using the Partial flag but it dose not work Xapian::Query query = parser.parse_query("m*",parser.FLAG_PARTIAL);<br>
> > > Do you have any example or any tutorial is appreciated.<br>
> > ><br>
> > > --Naveen.<br>
> > > _______________________________________________<br>
> > > Xapian-devel mailing list<br>
> > > <a href="mailto:Xapian-devel@lists.xapian.org">Xapian-devel@lists.xapian.org</a><br>
> > > <a href="http://lists.xapian.org/mailman/listinfo/xapian-devel" target="_blank">http://lists.xapian.org/mailman/listinfo/xapian-devel</a><br>
> ><br>
> > --<br>
> > James Aylett, occasional trouble-maker<br>
> > <a href="http://xapian.org" target="_blank">xapian.org</a><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > Xapian-devel mailing list<br>
> > <a href="mailto:Xapian-devel@lists.xapian.org">Xapian-devel@lists.xapian.org</a><br>
> > <a href="http://lists.xapian.org/mailman/listinfo/xapian-devel" target="_blank">http://lists.xapian.org/mailman/listinfo/xapian-devel</a><br>
><br>
> --<br>
> James Aylett, occasional trouble-maker<br>
> <a href="http://xapian.org" target="_blank">xapian.org</a><br>
><br>
><br>
> _______________________________________________<br>
> Xapian-devel mailing list<br>
> <a href="mailto:Xapian-devel@lists.xapian.org">Xapian-devel@lists.xapian.org</a><br>
> <a href="http://lists.xapian.org/mailman/listinfo/xapian-devel" target="_blank">http://lists.xapian.org/mailman/listinfo/xapian-devel</a><br>
<br>
--<br>
James Aylett, occasional trouble-maker<br>
<a href="http://xapian.org" target="_blank">xapian.org</a><br>
<br>
</div></div></blockquote></div><br>