Flavio Castelli

Debugging my life.

How to Have Some Fun With Strigi and Xesam Queries

| Comments

Last day just after I hit the “submit” button a doubt came into my mind: “did I say everything ?” Well, the answer is “No!” In fact I forgot to tell you one of the most important things: how to have some fun with Strigi and Xesam! Actually the only way to perform XesamQueryLanguage queries with Strigi is through the strigicmd program.

Strigicmd is a command-line tool shipped with Strigi. It can perform different actions like:

  • create Strigi indexes
  • remove items from index
  • list all files contained into an index
  • retrieve informations associated to an indexed file
  • update the contents of your index
  • query the index
  • perform a query using XesamQueryLanguage

So, if you want to try the new Xesam support you’ve just to use strigicmd with the xesamquery option. The command syntax is: strigicmd xesamquery -t backend -d indexdir [-u xesam_user_language_file] [-q xesam_query_language_file] As you can expect you’ve to save your Xesam query to file and point strigicmd to it.

This is a really small step-by-step guide:

  • Create a new Strigi index (in this case I’ll index all irc logs): strigicmd create -t clucene -d temp/ logs/
  • Create a simple file containing your Xesam query. You can find some example query on Xesam site or inside strigi tarball (complete path: strigi/src/streamanalyzer/xesam/testqueries/). This is a stupid and easy query:

    [query] [ ]

1
2
3
4
5
6
7
8
9
10
11
12
13
    <request>
    <query>
    <or>
    <equals>
    <string casesensitive="true">Oever</string>
    </equals>
    <contains>
    <string casesensitive="false">jos</string>
    </contains>
    </or>
    </query>
    </request>

  • Perform the search, just type:

    strigicmd xesamquery -t clucene -d temp/ -q ~/irc_oever.xml

  • Enjoy the search results ;)

Remember that XesamUserLanguage query language isn’t yet supported.

Comments