Hello,

When I try to configure the default "More like this" block it seems like a field is missing :

Fields for finding related content *

There is no way of actually choosing the fields, which of course causes a validation error when I try to submit the form :

Fields for finding related content field is required.

The weird thing is, the More Like This block seems to be working just fine anyways, just the configuration that doesn't.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

soulfroys’s picture

Priority: Normal » Major

Same here (6.x-3.x-dev) :-(

Nick_vh’s picture

Seems to be working fine for me? Can you try with latest dev? Did you index your content already?

pwolanin’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

can't reproduce this - can you add a screen shot?

Note that the list of fields comes form the index.

Growiel’s picture

FileSize
12.71 KB
14.81 KB
40.86 KB

My content in indeed indexed. I just re-indexed it with the latest dev (to fix issue #1957070: "Solr search index will be rebuilt." message appears at the top of every view. (Even when index has been completely rebuilt.)) :

Index status

Here's a screenshot from the "More Like This" block configuration page :

No fields

As you can see, I can't select any fields.

And finally, when I submit the form, I have the following error, as expected :

validation error

pwolanin’s picture

Right, so you are not getting the field list from the index . This admin page actually makes a request to Solr if the result is not in the cache.

Check you logs for error messages.

soulfroys’s picture

My reports...
I'm using Solr 4.2.1 (Jetty) in all my tests:
Test 1: Drupal 7.21 + apachesolr 1.x-dev (last)
Test 2: Drupal 6.26 + apachesolr 6.x-3.x-dev (last, with this patch from #1550964: Support Solr 4.0 schema)

- 1 error in Solr log, but related to "i18n" (image).
- In both cases, no errors in Drupal log and I had the same result as @Growiel.

Growiel’s picture

I don't have anything in the logs, neither in Apache logs, Drupal reports or Solr logs.

However, I went ahead and searched the cause of the problem and located it :

function apachesolr_search_mlt_get_fields() {
  $rows = array();

  try {
    $solr = apachesolr_get_solr();
    $fields = $solr->getFields();
    foreach ($fields as $field_name => $field) {
      if ($field->schema{4} == 'V') {
        $rows[$field_name] = apachesolr_field_name_map($field_name);
      }
    }
    ksort($rows);
  }
  catch (Exception $e) {
    watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
  }

  return $rows;
}

The faulty part is the $field->schema{4}.

I var_dumped my fields and V only appears in 5th position :

string(7) "content" string(16) "ITS--V----------"
string(5) "label" string(16) "ITS--V--O-------"
string(10) "path_alias" string(16) "ITS--V--O-------"
string(14) "taxonomy_names" string(16) "IT--MV--O-------"
string(15) "tm_vid_10_names" string(16) "ITS-MV----------"

and so on.

This also explains why there's nothing in the logs : Solr does return something, it's the php part that ends up returning an empty array.

I don't know Solr well enough, but might this be due to the way Solr 4.x works as opposed to 3.x / 1.4 ?
Is this due to my own implementation (since I'm not the only one having the problem, I doubt it) ?

Hope that helps !

Growiel’s picture

Status: Postponed (maintainer needs more info) » Active
Growiel’s picture

Any update on this ? Do you want me to submit a patch changing 4 to 5 ?

justluvgod’s picture

I was experiencing the same issue.

configuration:

- Drupal 7.21
- Apache SOLR integration - 7.x-1.2
- SOLR 3.6.2

I made the change you suggested (changing 4 to 5) and now the field boxes appear. Thanks for your help.

For anyone who wants to implement this update, the document of reference is apachesolr_search.module located in the apachesolr module.

Nick_vh’s picture

So this is a difference between solr 3 and 4? We should use the getSolrVersion function to see how we react on the different outputs

Growiel’s picture

Doesn't looks like it since I use Solr4 and justluvgod is using Solr3.

Greg Varga’s picture

I can confirm that changing
if ($field->schema{4} == 'V') {
to
if ($field->schema{5} == 'V') {
in apachesolr_search_mlt_get_fields() does work for Solr 4. (Module: 7.x-1.2)
I agree, Solr version has to be checked in this function.

pwolanin’s picture

Status: Active » Needs review
FileSize
1.05 KB

It would seem the position is not significant, just the letter?

Solr 3.6.2 has this key, which indicates each letter is unique:

  "info":{
    "key":{
      "I":"Indexed",
      "T":"Tokenized",
      "S":"Stored",
      "M":"Multivalued",
      "V":"TermVector Stored",
      "o":"Store Offset With TermVector",
      "p":"Store Position With TermVector",
      "O":"Omit Norms",
      "F":"Omit Term Frequencies & Positions",
      "P":"Omit Positions",
      "L":"Lazy",
      "B":"Binary",
      "f":"Sort Missing First",
      "l":"Sort Missing Last"},
    "NOTE":"Document Frequency (df) is not updated when a document is marked for deletion.  df values include deleted documents."}}
jrreid’s picture

Patch in #14 works for me (Solr 4.3.0)

pwolanin’s picture

Title: More Like This blocks configuration page broken » More Like This blocks configuration page broken due to change in schema map positions
Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Needs review » Patch (to be ported)

fixed in 7 and 6.x-3.x

may need to be ported to 6.x-1.x

stephenplatz’s picture

Same issue, using 7.x-1.3 and Solr 4.3.1. Patch #14 works.

Khalilou’s picture

Same issue, using 7.x-1.3 and Solr 4.3.1. Patch #14 works.

pwolanin’s picture

This is in the latest release - please upgrade.

venky123’s picture

Status: Patch (to be ported) » Needs review

I am using upgraded version of drupal and solr-4.4.0
But the problem still persists in windows system.
Its("FIELDS FOR FINDING RELATED CONTENT") working fine in Linux system.