code: def test_flat_ip(self):
      import faiss
  
      index = FaissIndex(metric_type=faiss.METRIC_INNER_PRODUCT)
  
      # add vectors
      index.add_vectors(np.eye(5, dtype=np.float32))
      self.assertIsNotNone(index.faiss_index)
      self.assertEqual(index.faiss_index.ntotal, 5)
      index.add_vectors(np.zeros((5, 5), dtype=np.float32))
      self.assertEqual(index.faiss_index.ntotal, 10)
  
      # single query
      query = np.zeros(5, dtype=np.float32)
      query[1] = 1
      scores, indices = index.search(query)
      self.assertRaises(ValueError, index.search, query.reshape(-1, 1))
      self.assertGreater(scores[0], 0)
      self.assertEqual(indices[0], 1)
  
      # batched queries
      queries = np.eye(5, dtype=np.float32)[::-1]
      total_scores, total_indices = index.search_batch(queries)
      self.assertRaises(ValueError, index.search_batch, queries[0])
      best_scores = [scores[0] for scores in total_scores]
      best_indices = [indices[0] for indices in total_indices]
      self.assertGreater(np.min(best_scores), 0)
      self.assertListEqual([4, 3, 2, 1, 0], best_indices)
  
imports: import os
  import tempfile
  from functools import partial
  from unittest import TestCase
  from unittest.mock import patch
  import numpy
  import pytest
  from datasets.arrow_dataset import Dataset
  from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex
  from .utils import require_elasticsearch, require_faiss
label_desc: Use image node_id 1 for calling the FaissIndexTest obj's underlying member method code with example usage: obj.test_flat_ip() without return types