суббота, 6 августа 2011 г.

Alfresco: strong text search with wildcard using lucene

My new problem is not very difficult, but have interesting solution (I think :)). For example we have four objects in our alfresco repository that have next titles:
  • James John
  • Li Joan
  • Johan Jazz
  • Bill

For get all objects that begins from 'Joh', I use the next query:
+TYPE:"my:object" +@cm\:title:"joh*"

The result of the query:
  • James John
  • Johan Jazz
  • Li Joan

'Joan' doesn't contain 'joh' in title. For solve that I modify my query:
+TYPE:"my:object" +@cm\:title:"[joh*]"

This query returns the right result:
  • James John
  • Johan Jazz

You can find more lucene tricks in wonderful book that called: "Lucene in Action" :)

Комментариев нет:

Most popular

Authors