I have a apache solr server with 7 cores ot use in 7 diferent web sites. All of them works well using Drupal 6 and Apache Solr module.

But now with Drupal 7, search api and search api solr the last server doesn't return any result.

I've upload the schema.xml and solrconfig.xml to conf directory of the new core. I've used the last SolrPhpClient (r60).

When i look at schema browser it has documents indexed and fields (with stats).

The problem is when i search, it returns nothing.

I think i'm missing something but...¿what?

Comments

carlitus’s picture

Status: Active » Closed (fixed)

Now it works...i haven't change anything.

Sylvain_G’s picture

Got same issue with Solr 3.5 + Drupal 7.12 + Search API + Search API SolR

the solr backend http://localhost:8983/solr/admin/ never return any result, but server stat confirm index got a bunch of node and schema browser show some indexed content :(

Sylvain_G’s picture

It now works for me and i did not do much to the solr config... some warm up delay?

Ace Cooper’s picture

Status: Active » Closed (fixed)

Reporting the same issue here.
Running Drupal 7.18 with Search API Solr 7.x-1.x-dev (dated Dec 15, 2012) on Apache Solr 3.6.2 under CentOS 6.2 x64.
My server is Xeon 3.20Ghz with 4Gb RAM, Solr running at 1024 Mb memory limit.
I have created a clear test server with minimum modules and generated 50 simple custom nodes to test the issue.

After creating solr index or clearing index and indexing the content again - the search results are not available for 2 minutes.
The search page says "Your search yielded no results" for any request.
Then, after 1min50sec (yeah, i've checked several times) the solr search page starts to produce results.

The same setup with search_api_sphinx index produced results right after indexation.
Could someone with deeper understanding of solr magic please clear the situation for the rest of us?

Ace Cooper’s picture

Status: Closed (fixed) » Active
tkcent’s picture

Status: Closed (fixed) » Closed (works as designed)

It has to do with SOLR performance and the default commit time. In the solrconfig.xml file, you can see the maxTime of 120000 which is in milliseconds and corresponds to your observation of 2 minutes.

 <!-- The default high-performance update handler -->
  <updateHandler class="solr.DirectUpdateHandler2">

    <!-- AutoCommit

         Perform a <commit/> automatically under certain conditions.
         Instead of enabling autoCommit, consider using "commitWithin"
         when adding documents. 

         http://wiki.apache.org/solr/UpdateXmlMessages

         maxDocs - Maximum number of documents to add since the last
                   commit before automatically triggering a new commit.

         maxTime - Maximum amount of time that is allowed to pass   
                   since a document was added before automaticly
                   triggering a new commit. 
      -->
    <autoCommit>
      <maxDocs>10000</maxDocs>
      <maxTime>120000</maxTime> 
    </autoCommit>
NG@GE’s picture

Issue summary: View changes
Status: Closed (works as designed) » Needs review

Hi,
I am experiencing a similar issue here.
Using Drupal 7.43 with search_api, search_api_solr, search_api_attachments, Solr 5.5.0.
I have
- a correctly established connection to Solr server, with Solr (remote server) as extraction method in the attachments tab;
- an index for files based on Solr server where:
--- in Fields, File content is checked;
--- in Filters, Data attachments are selected;
--- I've already indexed successfully 2 files (pdf and txt, attached to 2 Basic pages);
- a view with:
--- format: unformatted list;
--- show: rendered entity;
--- search: fulltext search (exposed), searched fields File name and File content.

Behavior when searching within the view:
- sometimes, no results
- sometimes, the following error
Notice: Array to string conversion in SearchApiSolrService->createId() (line 646 of /var/www/html/mdw/modules/search_api_solr/includes/service.inc).
Warning: Illegal offset type in SearchApiSolrService->extractResults() (line 1342 of /var/www/html/mdw/modules/search_api_solr/includes/service.inc).

What would you say I am missing?

Regards

gwolfman’s picture

Hi @NGAGE, have you found a fix for this? I am running into the same problem.

Thanks

bloomt’s picture

Also having a similar issue to @NG@GE

Chris Charlton’s picture

Ditto, I just started to experience this issue as well. Node says it's indexed but does not appear in results. (Drupal 7)

rcaldeiradev’s picture

Almost the same issue here (without Solr).
It's generating not populated 'search_api_db_*' tables.

drunken monkey’s picture

Status: Needs review » Active

Please don't re-open issues that have been closed for over three years! Just open a new one, there is no benefit in resurrecting old ones. (Especially since it sounds like a completely different problem to me.)

Anyways, it seems for some reason Solr is returning an array as the result ID, which is of course strange. Or maybe some other module (like Attachments) alters the results (or indexed items) and changes this.
Try finding out what response Solr returns to see whether that already shows the problem. Otherwise, you'd have to debug the code to see where the change is made.
I can't reproduce the problem, so I can't help much here.

Also, "Needs review" is a status for when there is a patch. Use "Active" for issues that are just open.

@ Chris, Rafael: It seems like you're having yet again completely different issues than the ones described in #9. Please open separate issues for those as well!

tlor24’s picture

I had the same issue that NGAGE and others had pointed out by solr. Here's what I did to find out what the issue was for me. I hook into hook_preprocess_search_results() and dpm() out the $variables. It turns out, the results return from solr seem to have been assigned to results (which is the first array index in from $variables) but the search result template is looking for $search_results. I had to switch the variable from $search_results to $results and it worked out for me.

I'm not sure if this will work out for others. Good luck!

samhaldia’s picture

I am trying to implement Search API programatically following https://www.drupal.org/docs/8/modules/search-api/developer-documentation... . I am getting Search Count Result at $results = $query->execute(); // output as 1 results
but i don't get anything in $ids = implode(', ', array_keys($results->getResultItems())); What i am missing. I want to get the query items title, name

drunken monkey’s picture

What range() call did you make to the query? It seems like you might just have an offset greater than 0, or a limit of 0?
(Also, this is a completely different issue. Please open a new issue in such cases!)

la558’s picture

Hello,
I'm on Drupal 7 and Solr 7.3.1

Successfully created Solr server:
on the 'Edit' tab > Advanced > I have these related check boxes selected

  • Return an excerpt for all results
  • Retrieve result data from Solr

and a Solr index:
on the 'Edit' tab I selected

  • Server: solr server
  • Datasource options: Node, File, Search Server

on the 'Fields' tab, I selected:

  • Node
  • File
  • combined data
  • and other node specific information
  • File content (full text)

on the 'Filters' tab, I selected

  • File attachments -extract the content out of attached files and index it.
  • Aggregated fields
    • set 0 for the number of file indexed per field -so no restrictions
    • set the maximum file size to 50 MB -none of the files is larger than this

Indexed to success.

PROBLEM: no search results when searching inside file content
Things were working until last week; then suddenly no results showing when searching for words inside documents.
If I search for node information, like other fields such as title, date, etc., I do get results, but no results when searching for text that it is inside the files (all pdf).

Any ideas/suggestions on how to solve this??

Thanks

drunken monkey’s picture

Project: Search API Solr » Search API attachments

Seems like a problem in the Search API Attachments module, not this one. Apparently, file contents extraction stopped working for some reason.
To make sure this is the case, look inside your Solr server’s web UI for an item that has an attachment and see whether its attachment’s contents got correctly indexed. If not, try re-indexing (maybe just a single such item at a time) and afterwards look into the Drupal logs for any error messages.
If the attachment contents are in the Solr index, then it seems they are not searched (anymore) for some reason. See Debugging a Solr search for how to retrieve the Solr request sent and see whether this contains the correct fl parameters.

jacksinn’s picture

I'm on Drupal 8.x and have had similar issues. I could see the extracted data indexed in Solr but could not retrieve results. If I search on text that is in the title or body, the file attachment result returns but if I perform a search on text within the document then no results are returned.

I've tried on existing sites as well as new install with just the appropriate modules. I was able to solve my problem within the BackEndPluginBase's getQueryFulltextFields method.

Within this method (BackEndPluginBase::getQueryFulltextFields) it is performing an intersect
return $fulltext_fields === NULL ? $index_fields : array_intersect($fulltext_fields, $index_fields);
and since my file/attachment's fulltext field is in $ndex_fields but not $fulltext_fields (both have results from a getFulltextFields method) the intersect omits it. If I perform a union on the fields rather than an intersect e.g.
return $fulltext_fields === NULL ? $index_fields : array_unique(array_merge($fulltext_fields,$index_fields), SORT_REGULAR);
then I get the results back and life is good.

The SeachAPISolrBackend method 'search' specifically on on line 918 is calling this getQueryFulltextFields method. Given that BackendPluginBase is an abstract method, this method could either be changed in the abstract class to reflect the union and set as default behavior or it could be overridden in the SearchApiSolrBackend class to reflect this behavior. If indeed an intersect is the default intention between the arrays (both arrays must contain the data) then perhaps the overridden method should be applied.

Ultimately if the intersect works as intended then how does one ensure that the new fulltext field e.g. "My pdfs" (from the Search API Attachments' README) end up also in the $fulltext_fields(BackendPluginBase.php:367)? I've went line-by-line through the Search API Attachment's README and the only difference is that I've setup a Solr index rather that the Database index.

I'm going to poke around the Solr API Attachments module in the meantime to see if this field should indeed end up in the $fulltext_fields array somehow and where that may happen.

If it happens to be that a union rather than an intersect is intended then I could provide a patch within Search API (hesitant since it affects all Search API users) or as a method (with patch) in the SearchApiSolrBackend class.

drunken monkey’s picture

It seems you just need to include the field in your view’s “Search: Fulltext search” filter’s “Searched fields” setting.

f2boot’s picture

In 8.x-1.x branch at least, indexing entity:file prevents node/media to come out in search results if the search string is in the attached document.

See https://www.drupal.org/project/search_api_attachments/issues/3049199
If this solves your problem, please add this issue as related

jwrober’s picture

I have applied the above mentioned patch to my dev instance. I am still getting same issue described where content has been indexed, but no results come back. I have enabled the solr devel module from v8.x-2.7 and have api_attachments v8.x-1.0beta12 + the patch. If I call the same URI shown in the debug in another browser, I get one result back for a file entity as I would expect, however in the full drupal UI, I get nothing. Here are some screen shots that will hopefully help.

drunken monkey’s picture

In your case, results do come back (“Displaying result 1 – 1 of 1”), they just aren’t displayed correctly. You need to modify the display or row style of your view.
It doesn’t seem like that’s the problem that the others have.

jwrober’s picture

Thanks drunken monkey. In further review based on your tip, I was able to make a change to the search results view and am now returning results.

izus’s picture

Status: Active » Closed (outdated)