开发者

How do I do an efficient faceted search using multi-valued fields with solr php client?

I'm attempting to setup a faceted search for my website, but am running into problems.

The facet fields are setup as dynamic multiValued fields. Though most of the products only have one value for each faceted field (designated as fq_* where the * is the attributeid of the product attribute being stored), some have multiple values.

Faceted search was working great - nice and fast until I tried accessing a category 开发者_Go百科of our products where 1 or more of the products had multiple values on a faceted attribute. For this category (and others like it) I get an error from the php solr client: "500" Status: Internal Server Error.

After searching for a while I found that setting facet.method equal to "enum" that it solved the error - however this increased the amount of time it took to load the page dramatically.

Is there any way to do a faceted search like this with more efficiency? (I can handle it taking a little longer than the "fc" method, but not much).

Thanks.

Edit (here are the parameters):

$solr->search('categoryid:4810', 0, 15, array(8) {
  ["sort"]=>
  string(17) "price_Default asc"
  ["facet"]=>
  string(4) "true"
  ["facet.field"]=>
  array(12) {
    [0]=>
    string(7) "mfgname"
    [1]=>
    string(14) "fq_33111116587"
    [2]=>
    string(14) "fq_33111116586"
    [3]=>
    string(14) "fq_33111114704"
    [4]=>
    string(11) "fq_33113118"
    [5]=>
    string(9) "fq_331472"
    [6]=>
    string(10) "fq_3312052"
    [7]=>
    string(9) "fq_331611"
    [8]=>
    string(10) "fq_3312304"
    [9]=>
    string(14) "fq_33111116919"
    [10]=>
    string(9) "fq_331100"
    [11]=>
    string(9) "fq_331710"
  }
  ["facet.sort"]=>
  string(5) "false"
  ["facet.mincount"]=>
  int(1)
  ["facet.missing"]=>
  string(5) "false"
  ["facet.limit"]=>
  int(-1)
  ["facet.method"]=>
  string(4) "enum"
}
);


You are probably running into memory problems not of Solr, but of Tomcat... Solr's faceting takes a lot of memory and Tomcat's usual setup comes with a very low memory setup, increase the memory of your JAVA_OPTS:

(linux) export JAVA_OPTS="-Xmx3500m -Xms3500m"

or some other appropriate value to the amount of info you handle and your server has available.

Here are some good resources on this: http://wiki.apache.org/tomcat/FAQ/Memory http://helpdeskgeek.com/how-to/increase-tomcat-memory-allocation/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜