Full text search

Help
2010-02-23
2013-04-25
  • Jean Jordaan
    Jean Jordaan
    2010-02-23

    I want to add a field on a search form to just do a general text search across Plomino documents.
    However I can't add a field called SearchableText, as this name is reserved.
    It looks like I would have to provide a custom template to do this.
    Directing users to the Plone search for this case isn't ideal, as it's away from your app forms, and can return non-plomino-documents also.
    Is there a recommended way to approach this?

     
  • Eric Brehault
    Eric Brehault
    2010-02-23

    Hello,

    Well, the big thing here is we are talking about 2 different catalogs:
    - SearchableText is an index in the portal_catalog
    - but Plomino search forms use the local PlominoIndex catalog

    it is probably wiser to let SearchableText in portal_catalog

    so the idea here is not create Search form but a Page form where you will add an action "Search" that will use the portal_catalog
    ( you can restrict the search to Plomino doc using an appropriate request: {"portal_type": "PlomioDocument", "SearchableText": your_query} )

    Eric

     
  • Volker Till
    Volker Till
    2011-03-24

    Hi Eric,

    do you think, that it is possible to show the results of such a search in a PloninoView or a PlominoForm with datagrid field?

    The background of my question is, that due to the number of elements in my database (1500+) and the needed getObject() calls to find documents from other databases, which are linked the these documents, the performance is bad.

    It would be helpful, if I could have a search field, which behaves like the search field in dynamic views but which just starts a query to the portal_catalog instead of filtering all datasets in the PlominoDatabase.

    Regards,
    Volker

     
  • Volker Till
    Volker Till
    2011-03-25

    Hi Eric,

    just an idea:

    Would it be possible to have a datagrid field, which is filled by the results of the plone live search (restricted to PlominoDocuments)?

    Volker

     
  • Eric Brehault
    Eric Brehault
    2011-03-25

    Hello,

    if you make a Computed for display datagrid field, you can use any formaula to get the docs you want.
    So you can use the Plone API to get a search results from portal_catalog.

    nevertheless, 1500 docs is not a big quantity, so i guess you should find some strategy to store in your doc all relevant information to perform your searches without calling other dbs

    eric

     
  • Volker Till
    Volker Till
    2011-03-25

    Hi Eric,

    you will find the form "liste" in the database, which I uploaded to plomino.com. Actually, it takes between 10 to  30 seconds to open this this form.

    What do you mean with strategy? Any hint?

    Volker

     
  • Eric Brehault
    Eric Brehault
    2011-03-29

    Hello,

    here are my remarks:

    1 - avoid try /except to get item values:
    don't do this:
      try:
        t = doc.fldtitel
      except:
        t = ''
    do this:
    t = doc.getItem("fldtitel")

    2 - make sure your external functions are optimal:
    you call context.mydocurl and context.checkSelect, make sure the code is correct
    (by the way, if they are just Python scripts, you could the code into a script lib in the Plomino resources folder, it would be compiled and managed locally)

    3 - why do you have several dbs ?
    you could have all your forms (and corresponding doc) in a single db instead of the current db + funktionen + unternehmen (unless you need to use them separately in other contexts…)
    so you might have some common indexes in the unique plomino index

    4 - if your dbsearch in the loop cost too much, you can store the reference to the matching docs into your current doc
    so instead of call ing dbsearch to get the list, you would just read an item value
    nevertheless a dbsearch into a loop is acceptable when you have not too many docs
    another approach is to get all the funktionen docs in one call (getAllDocuments) and then sort them by person into a dictionary instead of calling dbsearch for each person

    5 - analyse the problem:
    make some tests: add some logs in you code
    and measure how many time is needed to complete the entire code (by looking the log date/time in your server log)
    then remove the different parts of the code and see how performances changes
    so you will know which part is guilty and need to be improved

    eric