Hello James,<div>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.</div>
<div>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.</div>
<div><br></div><div>I have the below questions.</div><div>1) Do xapian has Edge N gram analyzer or similar thing?</div><div>2) why there is only examples for basic indexing and searching ?But not for important features like facets and filtering, auto completion etc.</div>
<div> only snippets are available.Do you have some working example of facets,filters in c++? If i missed the links can you provide them? </div><div><br><div class="gmail_quote">On Sun, Oct 7, 2012 at 11:34 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">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>
<span><font color="#888888"><br>
James<br>
</font></span><div><div><br>
On 7 Oct 2012, at 18:16, Naveen A.N. <<a href="mailto:naveen@searchlabs.org" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">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></div>