Re: Announcing the Apache Solr extension in PHP - 0.9.0
Thanks Israel I plan to try it and compare with rsolr On Nov 23, 2009, at 2:28 PM, Michael Lugassy wrote: Thanks Israel, exactly what I was looking for, but how would one get a pre-compiled dll for windows? using PHP 5.3 VS9 TS. On Mon, Oct 5, 2009 at 7:03 AM, Israel Ekpo wrote: Fellow Apache Solr users, I have been working on a PHP extension for Apache Solr in C for quite sometime now. I just finished testing it and I have completed the initial user level documentation of the API Version 0.9.0-beta has just been released. It already has built-in readiness for Solr 1.4 If you are using Solr 1.3 or later in PHP, I would appreciate if you could check it out and give me some feedback. It is very easy to install on UNIX systems. I am still working on the build for windows. It should be available for Windows soon. http://solr.israelekpo.com/manual/en/solr.installation.php A quick list of some of the features of the API include : - Built in serialization of Solr Parameter objects. - Reuse of HTTP connections across repeated requests. - Ability to obtain input documents for possible resubmission from query responses. - Simplified interface to access server response data (SolrObject) - Ability to connect to Solr server instances secured behind HTTP Authentication and proxy servers The following components are also supported - Facets - MoreLikeThis - TermsComponent - Stats - Highlighting Solr PECL Extension Homepage http://pecl.php.net/package/solr Some examples are available here http://solr.israelekpo.com/manual/en/solr.examples.php Interim Documentation Page until refresh of official PHP documentation http://solr.israelekpo.com/manual/en/book.solr.php The C source is available here http://svn.php.net/viewvc/pecl/solr/ -- "Good Enough" is not good enough. To give anything less than your best is to sacrifice the gift. Quality First. Measure Twice. Cut Once.
Evaluating Solr and Ruby-Solr
We are also Evaluating Solr and Sphinx to see which one provides a suitable search solution for our ROR site. As a newbie I picked the Advanced Rails Recipes book and follow Recipe 27 before building our prototype. As I followed Recipe 27 of the Advanced Rails Recipes book. I tried to follow the steps exactly to see if I can drill down the search results using facets. Initially solr and solr-ruby appeared to work fine. The below statements worked great and I was able to query the solr index from Ruby. solr = Solr::Connection.new(’http://127.0.0.1:8983/solr’) response = solr.query(’pragmatic’, :facets => {:fields => ['pubisher_facet'], :mincount =>1}) docs = response.hits But when I ran response.facet_fields(’publisher_facet’) I got the below error response.field_facets(’publisher_facet’) NoMethodError: undefined method `size’ for nil:NilClass from C:/Ruby/lib/ruby/gems/1.8/gems/solr-ruby-0.0.7/lib/solr/util.rb:17:in `paired_array_each’ from C:/Ruby/lib/ruby/gems/1.8/gems/solr-ruby-0.0.7/lib/solr/response/standard.rb:43:in `field_facets’ from (irb):13 As development box, we currently use solr 1.3, Ruby 1.8.6 on Windows Vista, solr-ruby 0.0.7. Please advise if I missed something here wnen follow the recipe? Thank you. Thanh Below are installed gems on my pc. C:\Users\thanh>ruby -v ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] C:\Users\thanh>gem -v 1.3.1 C:\Users\thanh>gem list *** LOCAL GEMS *** actionmailer (2.3.2) actionpack (2.3.2) activerecord (2.3.2) activeresource (2.3.2) activesupport (2.3.2) capistrano (2.5.5) cgi_multipart_eof_fix (2.5.0) fxri (0.3.6) fxruby (1.6.16) gem_plugin (0.2.3) highline (1.5.0) hpricot (0.6.164) log4r (1.0.5) mongrel (1.1.5) mongrel_cluster (1.0.5) net-scp (1.0.2) net-sftp (2.0.2) net-ssh (2.0.11) net-ssh-gateway (1.0.1) ptools (1.1.6) rails (2.3.2) rake (0.8.4, 0.8.1) ruby-opengl (0.60.0) solr-ruby (0.0.7) test-unit (2.0.1) win32-api (1.2.1, 1.2.0) win32-clipboard (0.4.4) win32-dir (0.3.2) win32-eventlog (0.5.0) win32-file (0.5.5) win32-file-stat (1.3.1) win32-process (0.5.9) win32-sapi (0.1.4) win32-sound (0.4.1) windows-api (0.2.4) windows-pr (0.9.3)
Can we provide "context dependent" faceted navigation from SOLR search results
Assuming a solr search returns 10 listing items as below 1) 4 digital cameras 2) 4 LCD televisions 3) 2 clothing items If we navigate to /electronics we want solr to show us facets specific to 8 electronics items (e.g brand, price). If we navigate to /electronics/cameras we want solr to show us facets specific to 4 camera items (e.g mega-pixels, screens-size, brand, price). If we navigate to /electronics/televisions we want to see different facets and their counts specific to TV items. If we navigate to /clothing we want to obtain totally different facets and their counts. I am not sure if we can think of this as Hierarchical Facet Navigation system or not. >From the UI perspective , we can think of /electronics/cameras as Hierarchical classification. But how about electronics/cameras/canon vs electronics/canon/camera. In this case both navigation should show the same result set no matter which facet is selected first. My question is with the current solr implementation can we provide "context dependent" faceted navigation from SOLR search results? Thank you. Thanh Doan
Re: Can we provide "context dependent" faceted navigation from SOLR search results
After posting this question I found this discussion http://www.nabble.com/Hierarchical-Facets--to7135353.html. So what I did was adapting the scheme with 3 fields; cat, subcat,subsubcat and hardcoded the hierarchical logic in the UI layer to present hierarchical taxonomy for the users. The users still see somewhat similar to this page http://www.overstock.com/Electronics/Digital-Cameras/Canon,/brand,/813/cat.html But I have to say that hardcoding the hierarchical logic in UI layer is messy. It looks like Koji patch will be a much better solution. Thanks Koji! Thanh On Tue, Apr 28, 2009 at 11:27 AM, Matt Mitchell wrote: > Wow, this looks great. Thanks for this Koji! > > Matt > > On Tue, Apr 28, 2009 at 12:13 PM, Koji Sekiguchi wrote: > >> Thanh Doan wrote: >> >>> Assuming a solr search returns 10 listing items as below >>> >>> 1) 4 digital cameras >>> 2) 4 LCD televisions >>> 3) 2 clothing items >>> >>> If we navigate to /electronics we want solr to show >>> us facets specific to 8 electronics items (e.g brand, price). >>> If we navigate to /electronics/cameras we want solr to show us >>> facets specific to 4 camera items (e.g mega-pixels, screens-size, >>> brand, price). >>> If we navigate to /electronics/televisions we want to see different >>> facets and their counts specific to TV items. >>> If we navigate to /clothing we want to obtain >>> totally different facets and their counts. >>> >>> I am not sure if we can think of this as Hierarchical Facet Navigation >>> system or not. >>> >From the UI perspective , we can think of /electronics/cameras as >>> Hierarchical classification. >>> >>> >>> >> There is a patch for Hierarchical Facet Navigation: >> >> https://issues.apache.org/jira/browse/SOLR-64 >> >> But how about electronics/cameras/canon vs electronics/canon/camera. >>> In this case both navigation should show the same result set no matter >>> which facet is selected first. >>> >>> >>> >> The patch supports a document to have multiple hierarchical facet fields. >> for example: >> >> >> >> Canon Brand-new Digital Camera >> electronics/cameras/canon >> electronics/canon/cameras >> >> >> >> >> Koji >> >> My question is with the current solr implementation can we provide >>> "context dependent" faceted navigation from SOLR search results? >>> >>> Thank you. >>> Thanh Doan >>> >>> >>> >> >> > -- Regards, Thanh Doan 713-884-0576 http://datamatter.blogspot.com/
acts_as_solr patch support for Solr Cell style requests
Hi Erik et all, I am following this tutorial link http://www.lucidimagination.com/blog/tag/acts_as_solr/ to play with acts_as_solr and see if we can invoke solr cell right from our Rails app. following he tutorial i created classSolrCellRequest but dont know where to save the solr_cell_request.rb file to. Should I save file solr_cell_request.rb to /path/to/resume/vendor/plugins/acts_as_solr/lib directory or I have to save it to /path/to/resume/vendor/plugins/acts_as_solr/lib/solr/request directory where the Solr::Request::Select class locate? Thanks! Thanh Doan
Re: acts_as_solr patch support for Solr Cell style requests
I created Ruby class SolrCellRequest and saved it to /path/to/resume/vendor/plugins/acts_as_solr/lib directory. Here is code original from the tutorial. module ActsAsSolr class SolrCellRequest < Solr::Request::Select def initialize(doc,file_name) . . def handler 'update/extract' end end class SolrCellResponse < Solr::Response::Ruby end end however when I start using it $ script/console Loading development environment (Rails 2.2.2) >> solr = Solr::Connection.new("http://localhost:8982/solr";) >> req = SolrCellRequest.new(Solr::Document.new(:id=>1), '/path/to/resume.pdf') I got this error > req = SolrCellRequest.new(Solr::Document.new(:id=>1), > '/Users/tcdoan/eric.pdf') LoadError: Expected /Users/tcdoan/resume/vendor/plugins/acts_as_solr/lib/solr_cell_request.rb to define SolrCellRequest from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:426:in `load_missing_constant' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:92:in `const_missing' from (irb):2 Can you tell what was wrong here. Thanks. Thanh On Wed, May 13, 2009 at 6:11 PM, Thanh Doan wrote: > Hi Erik et all, > > I am following this tutorial link > http://www.lucidimagination.com/blog/tag/acts_as_solr/ > > to play with acts_as_solr and see if we can invoke solr cell right > from our Rails app. > > following he tutorial i created class c but dont > know where to save the solr_cell_request.rb file to. > > Should I save file solr_cell_request.rb to > /path/to/resume/vendor/plugins/acts_as_solr/lib directory > or > I have to save it to > /path/to/resume/vendor/plugins/acts_as_solr/lib/solr/request directory > where the Solr::Request::Select class locate? > > Thanks! > > Thanh Doan > -- Regards, Thanh Doan 713-884-0576 http://datamatter.blogspot.com/
Facet query return zero hits if category facet value has 2 or more words (looks like space does not work)
I used latest acts_as_solr to index a number of sample 'sale' items. Those item documents has a facet field, Its name is cat2_facet. There are a number of documents that have cat2_facet= "Shoes" and There are a number of documents that have cat2_facet= "*Top Wear*". The problem is the space between *Top and Wear*. results = Item.find_by_solr("[* TO *]", {:facets=>{:zeros=>false,:fields=>[:cat1, :cat2] }}) results.facets["facet_fields"] return {"cat1_facet"=>{"electronics"=>5, "clothing"=>5}, *"cat2_facet"=>{"Bottom Wear"=>1, "Top Wear"=>2*, "Shoes"=>2, "HDTV"=>1, "Camera"=>4}} When I issue the query below results = Item.find_by_solr("[* TO *] AND cat2:Shoes", {:facets=>{:zeros=>false,:fields=>[:cat1, :cat2] }}) It returned correct number of hits. However when i run the query results = Item.find_by_solr("[* TO *] AND cat2:*Top Wear*", {:facets=>{:zeros=>false,:fields=>[:cat1, :cat2] }}) It return zero hit (incorrect). I even tried to put quote and double quote for the facet value @results = Item.find_by_solr("[* TO *] AND cat2:'*Top Wear'*", {:facets=>{:zeros=>false,:fields=>[:cat1, :cat2] }}) And it still does not work. What should I do to remedy this space issue? Let me also attach the translated solr query I saw in solr log file INFO: [] webapp=/solr path=/select params={facet=true&fl=pk_i,score&facet.mincount=1&q=([*+TO+*]+AND+cat2_facet:Shoes)+AND+(type_s:Item)&facet.limit=-1&facet.field=cat1_facet&facet.field=cat2_facet&qt=standard&wt=ruby} *hits=2* status=0 QTime=1 Jun 5, 2009 7:54:23 PM org.apache.solr.core.SolrCore execute INFO: [] webapp=/solr path=/select params={facet=true&fl=pk_i,score&facet.mincount=1&q=([*+TO+*]+AND+cat2_facet:Top+Wear)+AND+(type_s:Item)&facet.limit=-1&facet.field=cat1_facet&facet.field=cat2_facet&qt=standard&wt=ruby} *hits=0* status=0 QTime=10 Thank you. Thanh
Re: Facet query return zero hits if category facet value has 2 or more words (looks like space does not work)
Hi Steve, No. My cat2_facet field does not have id number. In the 2 queries below... not sure why query 1 did not work and query 2 worked perfectly. 1) query 1 (should return 2 documents, but it did not work) webapp=/solr path=/select params={facet=true&fl=pk_i,score&facet.mincount=1&q=([*+TO+*]+AND+* cat2_facet:Top+Wear*)+AND+(type_s:Item)&facet.limit=-1&facet.field=cat1_facet&facet.field=cat2_facet&qt=standard&wt=ruby} *hits=0* status=0 QTime=10 2) query 2 (worked. did return 2 documents) webapp=/solr path=/select params={facet=true&fl=pk_i, score&facet.mincount=1&q=([*+TO+*]+AND+*cat2_facet:Shoes*)+AND+(type_s:Item)&facet.limit=-1&facet.field=cat1_facet&facet.field=cat2_facet&qt=standard&wt=ruby} *hits=2* status=0 QTime=1 Have you ever used a string facet field in which the facet value contains 2 or more words like Brand:Hewlett Packard If yes, what the query looks like exactly to filter the results based on the facet value = 'Hewlett Packard'? Thanks. Thanh On Fri, Jun 5, 2009 at 10:09 PM, Stephen Weiss wrote: > Thanh, > > Do the categories have id numbers? What we do is we index the ID numbers > of our tags and categories, and then on display we pull the real text out of > the database. In our situation, since the tags and categories are > multilingual, it's a lot easier than converting from English to the other > language where conflicts in encoding can arise. The advantage is, the id > number never has a space or any special character, so it always works. > > Another quick and dirty option might be to index the field as type "string" > - but then you probably want to do this with a copyField since it'll make it > more cumbersome to search through with a text query. I haven't tried this > though so I'm not sure. > > -- > Steve > > > On Jun 5, 2009, at 9:00 PM, Thanh Doan wrote: > > I used latest acts_as_solr to index a number of sample 'sale' items. >> Those item documents has a facet field, Its name is cat2_facet. >> >> There are a number of documents that have cat2_facet= "Shoes" and >> There are a number of documents that have cat2_facet= "*Top Wear*". The >> problem is the space between *Top and Wear*. >> >> results = Item.find_by_solr("[* TO *]", >> {:facets=>{:zeros=>false,:fields=>[:cat1, :cat2] }}) >> results.facets["facet_fields"] >> >> return {"cat1_facet"=>{"electronics"=>5, "clothing"=>5}, >> *"cat2_facet"=>{"Bottom >> Wear"=>1, "Top Wear"=>2*, "Shoes"=>2, "HDTV"=>1, "Camera"=>4}} >> >> When I issue the query below >> >> results = Item.find_by_solr("[* TO *] AND cat2:Shoes", >> {:facets=>{:zeros=>false,:fields=>[:cat1, :cat2] }}) >> >> It returned correct number of hits. However when i run the query >> >> results = Item.find_by_solr("[* TO *] AND cat2:*Top Wear*", >> {:facets=>{:zeros=>false,:fields=>[:cat1, :cat2] }}) >> >> It return zero hit (incorrect). >> >> I even tried to put quote and double quote for the facet value >> >> @results = Item.find_by_solr("[* TO *] AND cat2:'*Top Wear'*", >> {:facets=>{:zeros=>false,:fields=>[:cat1, :cat2] }}) >> >> And it still does not work. What should I do to remedy this space issue? >> >> Let me also attach the translated solr query I saw in solr log file >> >> INFO: [] webapp=/solr path=/select >> >> params={facet=true&fl=pk_i,score&facet.mincount=1&q=([*+TO+*]+AND+cat2_facet:Shoes)+AND+(type_s:Item)&facet.limit=-1&facet.field=cat1_facet&facet.field=cat2_facet&qt=standard&wt=ruby} >> *hits=2* status=0 QTime=1 >> >> Jun 5, 2009 7:54:23 PM org.apache.solr.core.SolrCore execute >> >> INFO: [] webapp=/solr path=/select >> >> params={facet=true&fl=pk_i,score&facet.mincount=1&q=([*+TO+*]+AND+cat2_facet:Top+Wear)+AND+(type_s:Item)&facet.limit=-1&facet.field=cat1_facet&facet.field=cat2_facet&qt=standard&wt=ruby} >> *hits=0* status=0 QTime=10 >> >> Thank you. >> Thanh >> > >
Re: Filter query results do not match facet counts
> I am using the 2009-05-27 build of solr 1.4. >Under this build, I get a facet count on my category field named "Seasonal" of 7 values. > However, when I do a filter query of 'fq=cat:"Seasonal"', I get only 1 result. I have a slightly different problem. when I do a filter query of 'fq=cat:"Seasonal"', I got correct facet counts. But when I do a filter query of 'fq=cat:"Top Wear"', I got 0 facet counts. I used 05-10 nightly build. Is it a bug if the facet value contains 2 or more words. Can solr handle facet value that has space between words? This is the solr schema I used to configure my dynamic cat2_facet field http://github.com/mattmatt/acts_as_solr/blob/067d37879e88fd3c2d74fcc22263aff0f55ac1cc/solr/solr/conf/schema.xml Thanks. Thanh On Sat, Jun 6, 2009 at 9:00 AM, Yonik Seeley wrote: > On Mon, Jun 1, 2009 at 9:21 PM, shopDave > wrote: > > I am using the 2009-05-27 build of solr 1.4. Under this build, I get a > facet > > count on my category field named "Seasonal" of 7 values. However, when I > do > > a filter query of 'fq=cat:"Seasonal"', I get only 1 result. > > There was a bug from 5-20 through 5-27 in filter generation. > If you try a more recent nightly build, it should be fixed. > > -Yonik > http://www.lucidimagination.com >