Current time: 12-15-2017, 03:10 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database Query Search Time
08-19-2010, 08:22 PM
Post: #31
RE: Database Query Search Time
Hey Guys,

I know sorting has to be possible. There is documentation to sorting here:
http://lucene.apache.org/solr/tutorial.html#Sorting

This query here works for sorting:
http://localhost:8983/solr/products_id2/select/?q=gold&version=2.2&start=0&rows=10&indent=on&sort=custom3+desc

The cfsearch wrapper that is used to communicate with the SOLR interface does not look like it supports sorting, which is very odd - at least i can not find any documentation on this.

#1 - I am wondering if it is possible to use the value in a cfcollection custom3 column to influence the SCORE value. If this is possible, I might be able to force sorting the score a particular way instead of by relevancy.

#2 - I wonder if anybody has created a custom wrapper that communicates with the SOLR interface - an alternative to cfsearch.

My problems with cfsearch right now are sorting and returning columns in the result query that are not needed. I wonder if I can file suggestions for the next version of coldfusion.

Sincerely,
Travis Walters
Find all posts by this user
Quote this message in a reply
08-21-2010, 11:34 PM (This post was last modified: 08-22-2010 02:21 AM by green-watch.org.)
Post: #32
RE: Database Query Search Time
Hey Everyone,

I have spent the last couple days creating my own function that communicates with the SOLR interface. This tag can be used as an alternative to cfsearch. Here is version 1.0 of my SOLR_SEARCH code:

Code:
<cfsetting requestTimeOut = "60">

<cfset SOLR_SERVER_HOST = 'localhost'>
<cfset SOLR_SERVER_PORT = '8983'>
<cfset SOLR_SERVER_VERSION = '2.2'>

<cffunction name="SOLR_SEARCH" returnType="struct">

  <cfargument name="collection" type="string" required="true" default="">
  <cfargument name="criteria" type="string" required="false" default="*:*">
  <cfargument name="startrow" type="string" required="false" default="0">
  <cfargument name="maxrows" type="string" required="false" default="10">
  <cfargument name="sort" type="string" required="false" default="">
  <cfargument name="columns" type="string" required="false"
  default="category,custom1,custom2,custom3,custom4,key,score,size,summary,title">
  <cfargument name="facet" type="string" required="false" default="">
  <cfargument name="timeout" type="string" required="false" default="10">
  <cfargument name="timeAllowed" type="string" required="false" default="10">
  
  <cfset returnStruct = StructNew()>
  
  <cfif NOT IsDefined("timeout") OR NOT IsNumeric(timeout) OR #timeout# LT 1>
    <cfset timeout = 10>
  </cfif>

  <cfif NOT IsDefined("timeAllowed") OR NOT IsNumeric(timeAllowed) OR #timeAllowed# LT 1>
    <cfset timeAllowed = 10>
  </cfif>

  <cfif NOT IsDefined("startrow") OR NOT IsNumeric(startrow) OR #startrow# LT 0>
    <cfset startrow = 0>
  </cfif>

  <cfif NOT IsDefined("maxrows") OR NOT IsNumeric(maxrows) OR #maxrows# LT 1>
    <cfset maxrows = 1>
  </cfif>

  <cfif NOT IsDefined("criteria")>
    <cfset criteria = "*:*">
  </cfif>

  <cfset myURL = 'http://#SOLR_SERVER_HOST#:#SOLR_SERVER_PORT#/solr/#collection#/select/'>
  <cfset myURL = '#myURL#?q=#criteria#&version=#SOLR_SERVER_VERSION#&start=#startrow#&rows=#maxrows#&indent=off'>

  <cfif IsDefined("sort") AND #sort# NEQ "">
    <cfset myURL = '#myURL#&sort=#sort#'>
  </cfif>

  <cfif IsDefined("columns") AND #columns# NEQ "">
    <cfset myURL = '#myURL#&fl=#columns#'>
  </cfif>

  <cfif IsDefined("facet") AND #facet# NEQ "">
    <cfset myURL = '#myURL#&facet=true&#facet#'>
  </cfif>  

  <cfif IsDefined("timeAllowed") AND #timeAllowed# NEQ "">
    <cfset myURL = '#myURL#&timeAllowed=#timeAllowed#'>
  </cfif>  

  <cfhttp method="Get" url="#myURL#" resolveurl="Yes" timeout="#timeout#" throwonerror="yes" />

  <cfset xmlfile=XMLParse(cfhttp.FileContent)>

  <cfset numResultsFound = #xmlfile.XmlRoot.XmlChildren[2].XmlAttributes.numFound#>
  <cfset queryStatus = #xmlfile.XmlRoot.XmlChildren[1].XmlChildren[1].XmlText#>
  <cfset queryTime = #xmlfile.XmlRoot.XmlChildren[1].XmlChildren[2].XmlText#>
  <cfset numResultsReturned = #ArrayLen(xmlfile.XmlRoot.XmlChildren[2].XmlChildren)#>

  <cfset queryFieldList = ''>

  <cfloop index="i" from="1" to="#ArrayLen(xmlfile.XmlRoot.XmlChildren[1].XmlChildren)#">  
    <cfif #xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlAttributes.name# EQ "params">
      <cfloop index="j" from="1" to="#ArrayLen(xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlChildren)#">
        <cfif #xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlChildren[j].XmlAttributes.name# EQ "fl">
          <cfset queryFieldList = #xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlChildren[j].XmlText#>
        </cfif>
      </cfloop>
    </cfif>  
  </cfloop>

  <cfif #queryFieldList# NEQ "">    
      
    <cfset xmlqry = QueryNew("#queryFieldList#")>  
        
    <cfif #numResultsReturned# NEQ 0>

      <cfset xmlqryRows = QueryAddRow(xmlqry,numResultsReturned)>

      <cfloop index="i" from="1" to="#numResultsReturned#">
          
        <cfif #ArrayLen(xmlfile.XmlRoot.XmlChildren[2].XmlChildren[i].XmlChildren)# NEQ 0>    
          
          <cfloop index="j" from="1" to="#ArrayLen(xmlfile.XmlRoot.XmlChildren[2].XmlChildren[i].XmlChildren)#">
            
            <cfloop list="#queryFieldList#" index="k">
            
              <cfset myElement = '#xmlfile.XmlRoot.XmlChildren[2].XmlChildren[i].XmlChildren[j].XmlAttributes#'>
              
                 <cfif #ArrayLen(StructFindValue(myElement,k))# NEQ 0>
            
                <cfif #k# NEQ "category">
                  <cfset myElement = '#xmlfile.XmlRoot.XmlChildren[2].XmlChildren[i].XmlChildren[j].XmlText#'>
                  <cfset xmlqryCell = QuerySetCell(xmlqry,"#k#",myElement,"#i#")>
                <cfelse>
                  <cfset catList = '#xmlfile.XmlRoot.XmlChildren[2].XmlChildren[i].XmlChildren[j].XmlChildren[1].XmlText#'>
                  <cfset xmlqryCell = QuerySetCell(xmlqry,"#k#",catList,"#i#")>
                </cfif>
              
              </cfif>        
      
            </cfloop>
      
          </cfloop>
        
        </cfif>
    
      </cfloop>
      
    </cfif>
  
    <cfset xmlqry2 = QueryNew("RESULTS_FOUND,QUERY_STATUS,QUERY_TIME,RESULTS_RETURNED")>
    <cfset xmlqryRows = QueryAddRow(xmlqry2,1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry2,"RESULTS_FOUND","#numResultsFound#",1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry2,"QUERY_STATUS","#queryStatus#",1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry2,"QUERY_TIME","#queryTime#",1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry2,"RESULTS_RETURNED","#numResultsReturned#",1)>

    <cfset xmlqry3 = QueryNew("QUERY_TIMEOUT,NULL_FIELDLIST")>
    <cfset xmlqryRows = QueryAddRow(xmlqry3,1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry3,"QUERY_TIMEOUT","0",1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry3,"NULL_FIELDLIST","0",1)>
    
    <cfset returnStruct[0] = xmlqry3>
    <cfset returnStruct[1] = xmlqry2>
    <cfset returnStruct[2] = xmlqry>
    
  <cfelse>

    <cfset xmlqry3 = QueryNew("QUERY_TIMEOUT,NULL_FIELDLIST")>
    <cfset xmlqryRows = QueryAddRow(xmlqry3,1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry3,"QUERY_TIMEOUT","0",1)>    
    <cfset xmlqryCell = QuerySetCell(xmlqry3,"NULL_FIELDLIST","1",1)>
    <cfset returnStruct[0] = xmlqry3>
        
  </cfif>
  
  <cfreturn returnStruct>
  
</cffunction>

<cfparam name="URL.SEARCH_FOR" default="" type="string">

<cfset args = StructNew()>
<cfset args.collection = "products_id2">
<cfset args.startrow = 0>
<cfset args.maxrows = 10>
<cfset args.columns = 'key,custom1,custom2,custom3,custom4,summary,title'>
<cfset args.sort = 'score+desc'>
<cfset args.criteria = '#URL.SEARCH_FOR#'>
<cfset args.timeout = 5>
<cfset args.timeAllowed = 3000>

<cfinvoke method="SOLR_SEARCH" argumentCollection="#args#" returnVariable="res">

<cfdump var="#res#">

This code has a few advantages over cfsearch:

- You can specify which columns should be in the result query
- You can specify a maximum time to search for results
- The results can be sorted numerous ways

Please note, I never looked for documentation on the exact format SOLR returns its results with. Thus, the XML document interpretation may have a few kinks in it. However, what I have is a great starting basis. Coders can feel free to use my code above. It must remain free. Use the code at your own risk; you are passing URL variables to your SOLR Server so there are security implications that could arise. I suggest making sure that you use HTMLEditFormat before passing any variables to the function that are retrieved from user input. If by any chance a coldfusion developer comes across employed by Adobe, I strongly urge you to expand your cfsearch tag using the same concepts provided by my code. Lastly, I am using SOLR version 2.2. The code may not work with other versions of SOLR.

I am estimating a working product search by the beginning of September. I will post a link to the feature at that time. I am very excited to get everything up and running for green products.

Sincerely,
Travis Walters
Find all posts by this user
Quote this message in a reply
08-22-2010, 07:58 PM (This post was last modified: 08-22-2010 08:18 PM by green-watch.org.)
Post: #33
RE: Database Query Search Time
Hey Guys,

Be careful when sorting by a column when dealing with numbers. I tried to sort by custom3+desc and got these results:

10002,10004,10006,10008,10010,10016,10019,1002141,10022,10023

The incorrect sort in this sequence is obviously the 1002141. It appears to be reading left to right as if it were comparing strings. I believe adding "00" in front of all products except the 1002141 term and then sorting will yield correct results. I wonder if there is anyway to tell SOLR that a field is suppose to be numeric as opposed to text?

One thing I like most about SOLR is the timeAllowed parameter, which I started discussing a little in the last post.

To search for "gold" for no longer than 2 seconds, you can do this:
http://localhost:8983/solr/products_id2/select/?q=gold&version=2.2&start=0&rows=10&indent=on&timeAllowed=2000

With CFQUERY, you can specify a timeout. However, if the search time exceeds the timeout value, it throws an error instead of returning the results it found in the maximum time specified. CFQUERY is rather common with coldfusion. I really think they should add a TIMEALLOWED variable to CFQUERY. As soon as I can figure out where to make suggestions to the Adobe Coldfusion team, I have a few ideas I think they would like.

Update: I found that I can make suggestions to Adobe here:
http://cfbugs.adobe.com/cfbugreport/flex.../main.html

I opened reports 83899 and 83898.

Sincerely,
Travis Walters
Find all posts by this user
Quote this message in a reply
08-22-2010, 09:12 PM (This post was last modified: 08-22-2010 11:35 PM by green-watch.org.)
Post: #34
RE: Database Query Search Time
Hey Everyone,

In my last post, I questioned if it was possible to tell SOLR that a field should be numeric as opposed to text. The answer is yes and here is how:

You need to find the path where you store the collection. For example, mine is:
F:\collections\products_id2\conf

In this directory, there is a file called schema.xml. Open that with notepad. Do a search for custom3 for example and you will see where the value is set to text. I changed this to integer. I also changed indexed="false" to indexed="true" for the key value. It appears SOLR only allows sorting by indexed fields. Once I changed the index to true, then I could sort by the key.

I remember earlier I was having trouble with the custom2 field where I was storing the price. I bet if I changed that to integer and reindexed my products I could use those ranges I was playing around with that would not work before. I plan to create a second collection later this week with prices instead of price ranges and see if it will work.

Update: It appears if you change the schema values, your collection may need reindexed before fields are sorted correctly. For example, I could sort by key ascending, but not key descending. Once I indexed a test collection, it sorted correctly.

Sincerely,
Travis Walters
Find all posts by this user
Quote this message in a reply
08-23-2010, 01:22 AM
Post: #35
RE: Database Query Search Time
For the prices, unless everything is whole numbers you probably want to use a float type of some kind instead of integer (not sure what SOLR refers to it as) or even better would be a currency type if it supports one natively. Just wanted to point that out quickly so you don't have to re-index too often as you sort it out.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-23-2010, 03:05 PM
Post: #36
RE: Database Query Search Time
Hey Guys,

From what I have seen SOLR has float, double, integer, text, string, and other types. For product prices, I am now using custom3 to store price ranges and the title tag to store the actual prices. If I want to sort by price, I can just sort the title field.

It would be interesting to see if you can create your own fields in SOLR such as custom5, custom6, custom7, etc. However, if it is possible, CFINDEX only allows up to custom4. I suppose it would be possible to create a wrapper to do custom indexing.

I have written Adobe and said it would be nice if the CFCOLLECTION tag allowed more control over how the schema.xml file is setup. It would be nice if coldfusion could set field types, whether they are indexable, and create new fields if necessary. Instead of CFINDEX having a parameter for each field type, they could just have one parameter that accepts a CFQUERY that contains field name x value.

Product searches are usually pretty advanced. Coldfusion is only allowing enough fields to do searching on instead of fields that will be displayed in the search results. For example, I do not have enough variables to store a photo URL, the actual product description vs the summary, and the product name. When I am using coldfusion, I am focusing on returning only the KEY field which contain PRODUCT_ID numbers. From there, I can use CFQUERY to retrieve the product info I want displayed directly from the database. If coldfusion allowed more variables, that would reduce the number of round trips to the database.

On another note, it is probably a good idea to have two cfcollections of products. While one is getting updating using CFINDEX, the other one is searchable and will not get time out errors quite as easily.

I find that when using CFINDEX, it is best to have the indexing script called every 5 to 10 minutes. This supercedes what I said earlier in this thread. When I had times set less than 5 minutes, some problems occurred on the server. It is running more efficiently between 5 to 10 minutes. This would depend on your server setup.

Sincerely,
Travis Walters
Find all posts by this user
Quote this message in a reply
08-23-2010, 06:48 PM
Post: #37
RE: Database Query Search Time
Hey Guys,

I made a few updates to the SOLR_SEARCH function. Here is version 1.2 of my code:

Code:
<cfsetting requestTimeOut = "60">

<cfset SOLR_SERVER_HOST = 'localhost'>
<cfset SOLR_SERVER_PORT = '8983'>
<cfset SOLR_SERVER_VERSION = '2.2'>

<cffunction name="SOLR_SEARCH" returnType="struct">

  <cfargument name="collection" type="string" required="true" default="">
  <cfargument name="criteria" type="string" required="false" default="*:*">
  <cfargument name="startrow" type="string" required="false" default="0">
  <cfargument name="maxrows" type="string" required="false" default="10">
  <cfargument name="sort" type="string" required="false" default="">
  <cfargument name="columns" type="string" required="false"
  default="category,custom1,custom2,custom3,custom4,key,score,size,summary,title">
  <cfargument name="facet" type="string" required="false" default="">
  <cfargument name="timeout" type="string" required="false" default="10">
  <cfargument name="timeAllowed" type="string" required="false" default="10">
  
  <cfset returnStruct = StructNew()>
  
  <cfif NOT IsDefined("timeout") OR NOT IsNumeric(timeout) OR #timeout# LT 1>
    <cfset timeout = 10>
  </cfif>

  <cfif NOT IsDefined("timeAllowed") OR NOT IsNumeric(timeAllowed) OR #timeAllowed# LT 1>
    <cfset timeAllowed = 10>
  </cfif>

  <cfif NOT IsDefined("startrow") OR NOT IsNumeric(startrow) OR #startrow# LT 0>
    <cfset startrow = 0>
  </cfif>

  <cfif NOT IsDefined("maxrows") OR NOT IsNumeric(maxrows) OR #maxrows# LT 1>
    <cfset maxrows = 1>
  </cfif>

  <cfif NOT IsDefined("criteria")>
    <cfset criteria = "*:*">
  </cfif>

  <cfset myURL = 'http://#SOLR_SERVER_HOST#:#SOLR_SERVER_PORT#/solr/#collection#/select/'>
  <cfset myURL = '#myURL#?q=#criteria#&version=#SOLR_SERVER_VERSION#&start=#startrow#&rows=#maxrows#&indent=off'>

  <cfif IsDefined("sort") AND #sort# NEQ "">
    <cfset myURL = '#myURL#&sort=#sort#'>
  </cfif>

  <cfif IsDefined("columns") AND #columns# NEQ "">
    <cfset myURL = '#myURL#&fl=#columns#'>
  </cfif>

  <cfif IsDefined("facet") AND #facet# NEQ "">
    <cfset myURL = '#myURL#&facet=true&#facet#'>
  </cfif>  

  <cfif IsDefined("timeAllowed") AND #timeAllowed# NEQ "">
    <cfset myURL = '#myURL#&timeAllowed=#timeAllowed#'>
  </cfif>  

  <cfhttp method="Get" url="#myURL#" resolveurl="Yes" timeout="#timeout#" throwonerror="yes" />

  <cfset xmlfile=XMLParse(cfhttp.FileContent)>

  <cfset numResultsFound = #xmlfile.XmlRoot.XmlChildren[2].XmlAttributes.numFound#>
  <cfset numResultsReturned = #ArrayLen(xmlfile.XmlRoot.XmlChildren[2].XmlChildren)#>

  <cfset partialResults = 'false'>
  <cfset queryFieldList = ''>
  <cfset queryStatus = ''>
  <cfset queryTime = ''>

  <cfloop index="i" from="1" to="#ArrayLen(xmlfile.XmlRoot.XmlChildren[1].XmlChildren)#">  
    <cfif #xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlAttributes.name# EQ "params">
      <cfloop index="j" from="1" to="#ArrayLen(xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlChildren)#">
        <cfif #xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlChildren[j].XmlAttributes.name# EQ "fl">
          <cfset queryFieldList = '#xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlChildren[j].XmlText#'>
        </cfif>
      </cfloop>
    <cfelseif #xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlAttributes.name# EQ "status">
      <cfset queryStatus = '#xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlText#'>
    <cfelseif #xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlAttributes.name# EQ "QTime">
      <cfset queryTime = '#xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlText#'>
    <cfelseif #xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlAttributes.name# EQ "partialResults">
      <cfset partialResults = '#xmlfile.XmlRoot.XmlChildren[1].XmlChildren[i].XmlText#'>      
    </cfif>      
  </cfloop>

  <cfif #queryFieldList# NEQ "">    
      
    <cfset xmlqry = QueryNew("#queryFieldList#")>  
        
    <cfif #numResultsReturned# NEQ 0>

      <cfset xmlqryRows = QueryAddRow(xmlqry,numResultsReturned)>

      <cfloop index="i" from="1" to="#numResultsReturned#">
          
        <cfif #ArrayLen(xmlfile.XmlRoot.XmlChildren[2].XmlChildren[i].XmlChildren)# NEQ 0>    
          
          <cfloop index="j" from="1" to="#ArrayLen(xmlfile.XmlRoot.XmlChildren[2].XmlChildren[i].XmlChildren)#">
            
            <cfloop list="#queryFieldList#" index="k">
            
              <cfset myElement = '#xmlfile.XmlRoot.XmlChildren[2].XmlChildren[i].XmlChildren[j].XmlAttributes#'>
              
                 <cfif #ArrayLen(StructFindValue(myElement,k))# NEQ 0>
            
                <cfif #k# NEQ "category">
                  <cfset myElement = '#xmlfile.XmlRoot.XmlChildren[2].XmlChildren[i].XmlChildren[j].XmlText#'>
                  <cfset xmlqryCell = QuerySetCell(xmlqry,"#k#",myElement,"#i#")>
                <cfelse>
                  <cfset catList = '#xmlfile.XmlRoot.XmlChildren[2].XmlChildren[i].XmlChildren[j].XmlChildren[1].XmlText#'>
                  <cfset xmlqryCell = QuerySetCell(xmlqry,"#k#",catList,"#i#")>
                </cfif>
              
              </cfif>        
      
            </cfloop>
      
          </cfloop>
        
        </cfif>
    
      </cfloop>
      
    </cfif>
  
    <cfset xmlqry2 = QueryNew("RESULTS_FOUND,QUERY_STATUS,QUERY_TIME,RESULTS_RETURNED,PARTIAL_RESULTS")>
    <cfset xmlqryRows = QueryAddRow(xmlqry2,1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry2,"RESULTS_FOUND","#numResultsFound#",1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry2,"QUERY_STATUS","#queryStatus#",1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry2,"QUERY_TIME","#queryTime#",1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry2,"RESULTS_RETURNED","#numResultsReturned#",1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry2,"PARTIAL_RESULTS","#partialResults#",1)>

    <cfset xmlqry3 = QueryNew("QUERY_TIMEOUT,NULL_FIELDLIST")>
    <cfset xmlqryRows = QueryAddRow(xmlqry3,1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry3,"QUERY_TIMEOUT","0",1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry3,"NULL_FIELDLIST","0",1)>
    
    <cfset returnStruct[0] = xmlqry3>
    <cfset returnStruct[1] = xmlqry2>
    <cfset returnStruct[2] = xmlqry>
    
  <cfelse>

    <cfset xmlqry3 = QueryNew("QUERY_TIMEOUT,NULL_FIELDLIST")>
    <cfset xmlqryRows = QueryAddRow(xmlqry3,1)>
    <cfset xmlqryCell = QuerySetCell(xmlqry3,"QUERY_TIMEOUT","0",1)>    
    <cfset xmlqryCell = QuerySetCell(xmlqry3,"NULL_FIELDLIST","1",1)>
    <cfset returnStruct[0] = xmlqry3>
        
  </cfif>
  
  <cfreturn returnStruct>
  
</cffunction>

<cfparam name="URL.SEARCH_FOR" default="" type="string">

<cfset args = StructNew()>
<cfset args.collection = "products_id2">
<cfset args.startrow = 0>
<cfset args.maxrows = 10>
<cfset args.columns = 'key,custom1,custom2,custom3,custom4,summary,title'>
<cfset args.sort = 'score+desc'>
<cfset args.criteria = '#URL.SEARCH_FOR#'>
<cfset args.timeout = 5>
<cfset args.timeAllowed = 3000>

<cfinvoke method="SOLR_SEARCH" argumentCollection="#args#" returnVariable="res">

<cfdump var="#res#">

SOLR returns a variable called "partialResults" when the "timeAllowed" is used up before the search reaches the end of the collection. This is useful if you wish to inform the user that increasing the search time may lead to more and / or better search results.

Sincerely,
Travis Walters
Find all posts by this user
Quote this message in a reply
08-23-2010, 08:45 PM
Post: #38
RE: Database Query Search Time
SOLR 1.4 has native replication support: http://wiki.apache.org/solr/SolrReplication and you can munge something together for earlier releases with ssh and rsync (if you are looking to separate the indexing and reading collections). That may be getting more advanced than your out-of-the-box configuration warrants though.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-23-2010, 10:06 PM (This post was last modified: 08-23-2010 10:06 PM by green-watch.org.)
Post: #39
RE: Database Query Search Time
Hey Guys,

I want to thank you all for recommending SOLR to me. Most searches are returning results to me within a fraction of a second and that is with searching millions of records. It is so much more advanced than CFQUERY that really there is no comparison.

I have read about so many more features that SOLR supports that I have not talked about. For example, here are a few documents from the (http://lucene.apache.org/solr/tutorial.html) documentation:

http://wiki.apache.org/solr/DistributedSearch
http://wiki.apache.org/solr/FunctionQuery
http://wiki.apache.org/solr/StatsComponent
http://wiki.apache.org/solr/ClusteringComponent

I doubt that I will ever need to distribute my collections among different servers. It is nice knowing that SOLR has this functionality just in case. I have checked back on the Adobe recommendations I have submitted. Thanks in advance to all those who vote to expand Coldfusion SOLR capabilities. It is nice hearing about people coming from there to read this thread. I have submitted report 83909 to Adobe just now that is a suggestion for coldfusion to add distributed search support. There is a lot that coldfusion needs before this with their SOLR integration, but this support should be there as well.

Sincerely,
Travis Walters
Find all posts by this user
Quote this message in a reply
08-24-2010, 03:30 PM (This post was last modified: 08-24-2010 03:30 PM by green-watch.org.)
Post: #40
RE: Database Query Search Time
Hey Guys,

Good news for any coldfusion SOLR developers out there - Adobe verified the bugs / enhancements that I submitted to them. It looks like they are targeting the release of the improvements for Coldfusion 10 Alpha.

It is great to see something nice to come out of all this work.

Sincerely,
Travis Walters
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)