0 Replies Latest reply on Jul 16, 2009 12:14 PM by pgriff

    CFINDEX CFSEARCH and Category support problem

    pgriff

      My search results are getting mixed up AFTER I use cfindex to add and delete new documents to an existing collection. The first time I create and populate a coll, its good. Then when I need to del and add some docs later, the results are mixed up.

       

      I'm using CF8ENT (8.0.1 updater) on a win2k server and the collection is using category support.

       

      If I do a dump on cfsearch without using a category or categorytree, the results are fine. But if I add either a cat or cattree to the cfsearch, the results are incorrect. Incorrect = category shows up correct, but doc associated with it (key, and all custom values) is incorrect.

       

      EXAMPLE: if I have 5 total docs in a collection and 2 of them are given a category of 'Finance' and the other three have the category 'Policy'. If I were to delete one of them (say one of the Policy docs) and then add two more Policy docs and then do a cfsearch using the 'Policy' category. It's likely that I'll get a Finannce document in my results even though the category input was Policy (the dump on cfsearch will show the finance doc having the policy category).  However, if I dump the cfsearch without discriminating on category, the output is correct (all policy docs are 'Policy' and all finance docs are 'Finanace').

       

      <!--- rmv doc from coll --->
      <cfoutput query="get_del_docs">
      <cfindex action="delete"
           collection="#mycol#"
           key="#path#/#filename#">
      </cfoutput>
      <!--- add doc to coll --->
      <cfoutput query="open_docs">
      <cfindex action="update"
               collection="#mycol#"
               type="file"
               key="#path#/#filename#"
               urlpath="http://#mydir#"
               title="#title#"
               category="#category#"
               categorytree="#type_id#"
               custom1="#title#"
               custom2="#acronym#"
               custom3="#post_date#"
               custom4="#document_id#">
      </cfoutput>


      <cfsearch
          collection ="#mycol#"
          name = "results"
          criteria = ""
          category="Policy"
          categorytree="">
      <cfdump var="#results#">

       

      I've noticed that when I see mixed up results, that if I RESTART the Coldfusion 8 Search Server service that the RESULTS ARE IMMEDIATELY FIXED (no reindexing needed). So it's almost like old docs are cached in the search service or something and cleared when I restart that service. Of course, add a script to stop/start the Search Service after each update/delete doesn't seem like the right solution to me.

       

      Anything I can do to fix this without restarting the search service when docs are deleted or added to a collection?
      Thanks