Prevent indexing the article content after 15 lines. I am using search API and Solr .  I need to index only the first 15 lines of each  article .
the remaining lines after 15 lines has content which i don't want to index .
Please suggest if its possible .
Anything is possible :)

You can write a custom module to alter the behaviour of search api.
In the search api module directory there is a file search_api.api.php, which gives information on the functions you can use to alter its behaviour.

For this you would make a custom data alteration like this - replace modulename and ModuleName with the name of your module (case sensitive).

This part goes in your .module file:

/**
 * Define available data alterations.
 *
 * Registers one or more callbacks that can be called at index time to add
 * additional data to the indexed items (e.g. comments or attachments to nodes),
 * alter the data in other forms or remove items from the array.
 *
 * Data-alter callbacks (which are called "Data alterations" in the UI) are
 * classes implementing the SearchApiAlterCallbackInterface interface.
 *
 * @see SearchApiAlterCallbackInterface
 *
 * @return array
 *   An associative array keyed by the callback IDs and containing arrays with
 *   the following keys:
 *   - name: The name to display for this callback.
 *   - description: A short description of what the callback does.
 *   - class: The callback class.
 *   - weight: (optional) Defines the order in which callbacks are displayed
 *     (and, therefore, invoked) by default. Defaults to 0.
 */
function modulename_search_api_alter_callback_info() {
  $callbacks['modulename_character_limit'] = array(
    'name' =&gt; t('Character limit'),
    'description' =&gt; t('Limit the number of characters that get indexed for a field.'),
    'class' =&gt; 'ModuleNameCharacterLimit',
    'weight' =&gt; 100, // Probably better for this one to run later than others so they get to run on the full content before you trim it. Can still be reordered via the UI though.
  );

  return $callbacks;
}


This goes in a file named modulename_processor_character_limit.inc that goes in a sub-directory of your module called 'includes':

&lt;?php

/**
 * @file
 * Contains ModuleNameCharacterLimit.
 */

/**
 * Processor for limiting the number of characters of a field that are indexed.
 */
class ModuleNameCharacterLimit extends SearchApiAbstractProcessor {

  public function configurationForm() {
    $form = parent::configurationForm();
    $form += array(
      'char_limit' =&gt; array(
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('Character limit'),
        '#description' =&gt; t('The maximum number of characters of the field that will be added to the index.'),
        '#default_value' =&gt; $this-&gt;options['char_limit'],
        '#required' =&gt; TRUE,
        '#element_validate' =&gt; array('element_validate_integer_positive'),
      ),
    );

    return $form;
  }

  protected function processFieldValue(&amp;$value) {
    // Chop unwanted characters from the value.
    $value = substr($value, 0, $this-&gt;options['char_limit']);
  }

}


This goes in your module's info file:

files[] = includes/modulename_processor_character_limit.inc


This will add a data alteration you can configure via the search api UI where you do things like configure the HTML filter.
You can set the number of characters to limit indexing to for our fields. - In your case, set to 15 and away you go.

(Full disclosure - I haven't tested this :))

[Edit]

As per your comment below, if you want to remove all text after a specific string (in this case "The below lines are confidential" you can do away with the char_limit setting and have a setting where you configure the text to check for (I'm calling it search_text) then change the processFieldValue() function to be:

protected function processFieldValue(&amp;$value) {
  // If the text is found anywhere in the value.
  if (($pos = strpos($value, $this-&gt;options['search_text'])) !== FALSE) {
    // Cut off everything after that.
    // The $pos is the start of the string so if you want to also
    // exclude the string itself use $pos, otherwise to include the
    // string use $pos + strlen($this-&gt;options['search_text'])
    $value = substr($value, 0, $pos);
  }
}


Note that strpos() will return the position of the first occurance if the string occurs multiple times, which I would think is what you would want in this case.

See PHP string functions for more info on these and other string manipulation functions.