Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
removed tags from the title
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Programmatic Search Api Solr - how to return How do I get only nidsnode IDs from the search results?

I'm using Search API Solr with custom searches in code, but I want to find a way to limit the return results to only the nid to save on bandwidth with our third-party solr server. I've tried $query->fields(array('nid')) but I receive the following error:.

SearchApiException: Trying to search on field nid which is no indexed fulltext field.

SearchApiException: Trying to search on field nid which is no indexed fulltext field.

CurrentI am using the following code (strippedsimplified) code:.

$index = search_api_index_load('my_index');
$query = $index->query();
$query->keys($search_terms);
$query->fields(array('nid')); // doesn't work
$results = $query->execute();
return $results;

Any idea how to achieve thisHow do I get only node IDs from $results?

Programmatic Search Api Solr - how to return only nids?

I'm using Search API Solr with custom searches in code, but I want to find a way to limit the return results to only the nid to save on bandwidth with our third-party solr server. I've tried $query->fields(array('nid')) but I receive the error:

SearchApiException: Trying to search on field nid which is no indexed fulltext field.

Current (stripped) code:

$index = search_api_index_load('my_index');
$query = $index->query();
$query->keys($search_terms);
$query->fields(array('nid')); // doesn't work
$results = $query->execute();
return $results;

Any idea how to achieve this?

How do I get only node IDs from the search results?

I'm using Search API Solr with custom searches in code, but I want to find a way to limit the return results to only the nid to save on bandwidth with our third-party solr server. I've tried $query->fields(array('nid')) but I receive the following error.

SearchApiException: Trying to search on field nid which is no indexed fulltext field.

I am using the following code (simplified).

$index = search_api_index_load('my_index');
$query = $index->query();
$query->keys($search_terms);
$query->fields(array('nid')); // doesn't work
$results = $query->execute();
return $results;

How do I get only node IDs from $results?

Source Link
Chris
  • 516
  • 3
  • 16

Programmatic Search Api Solr - how to return only nids?

I'm using Search API Solr with custom searches in code, but I want to find a way to limit the return results to only the nid to save on bandwidth with our third-party solr server. I've tried $query->fields(array('nid')) but I receive the error:

SearchApiException: Trying to search on field nid which is no indexed fulltext field.

Current (stripped) code:

$index = search_api_index_load('my_index');
$query = $index->query();
$query->keys($search_terms);
$query->fields(array('nid')); // doesn't work
$results = $query->execute();
return $results;

Any idea how to achieve this?