Class Q

java.lang.Object
ai.vespa.client.dsl.Q

public final class Q extends Object
Helper class for generating Vespa search queries https://docs.vespa.ai/en/reference/query-language-reference.html
  • Constructor Details

    • Q

      public Q()
  • Method Details

    • select

      public static Select select(String fieldName)
    • select

      public static Select select(String fieldName, String... others)
    • p

      public static Field p(String fieldName)
      P represents "parentheses", used for generated a query in the parentheses.
      Parameters:
      fieldName - the field name
      Returns:
      the field
    • p

      public static Query p(QueryChain query)
      P represents "parentheses", used for generated a query in the parentheses.
      Parameters:
      query - the query
      Returns:
      the query
    • p

      public static Query p()
      P represents "parentheses", used for generated a query in the parentheses. This method generates an empty query
      Returns:
      the empty query
    • rank

      public static Rank rank(Query query, Query... ranks)
      Rank rank. https://docs.vespa.ai/en/reference/query-language-reference.html#rank
      Parameters:
      query - the query
      ranks - the ranks
      Returns:
      the rank query
    • ui

      public static UserInput ui(String value)
      UI represents "userInput". https://docs.vespa.ai/en/reference/query-language-reference.html#userinput
      Parameters:
      value - the value
      Returns:
      the user input query
    • ui

      public static UserInput ui(Annotation a, String value)
      userInput with an annotation. https://docs.vespa.ai/en/reference/query-language-reference.html#userinput
      Parameters:
      a - the a
      value - the value
      Returns:
      the user input query
    • ui

      public static UserInput ui(String index, String value)
      A convenience method to generate userInput with default index annotation. https://docs.vespa.ai/en/reference/query-language-reference.html#userinput
      Parameters:
      index - the index
      value - the value
      Returns:
      the user input query
    • dotPdt

      public static DotProduct dotPdt(String field, Map<String,Integer> weightedSet)
      dotPdt represents "dotProduct". https://docs.vespa.ai/en/reference/query-language-reference.html#dotproduct
      Parameters:
      field - the field
      weightedSet - the weighted set
      Returns:
      the dot product query
    • wtdSet

      public static WeightedSet wtdSet(String field, Map<String,Integer> weightedSet)
      wtdSet represents "weightedSet". https://docs.vespa.ai/en/reference/query-language-reference.html#weightedset
      Parameters:
      field - the field
      weightedSet - the weighted set
      Returns:
      the weighted set query
    • nonEmpty

      public static NonEmpty nonEmpty(Query query)
      NonEmpty non empty. https://docs.vespa.ai/en/reference/query-language-reference.html#nonempty
      Parameters:
      query - the query
      Returns:
      the non empty query
    • wand

      public static Wand wand(String field, Map<String,Integer> weightedSet)
      Wand wand. https://docs.vespa.ai/en/reference/query-language-reference.html#wand
      Parameters:
      field - the field
      weightedSet - the weighted set
      Returns:
      the wand query
    • wand

      public static Wand wand(String field, List<List<Integer>> numericRange)
      Wand wand. https://docs.vespa.ai/en/reference/query-language-reference.html#wand
      Parameters:
      field - the field
      numericRange - the numeric range
      Returns:
      the wand query
    • weakand

      public static WeakAnd weakand(Query query)
      Weakand weak and. https://docs.vespa.ai/en/reference/query-language-reference.html#weakand
      Parameters:
      query - the query
      Returns:
      the weak and query
    • geoLocation

      public static GeoLocation geoLocation(String field, Double longitude, Double latitude, String radius)
      GeoLocation geo location https://docs.vespa.ai/en/reference/query-language-reference.html#geolocation
      Parameters:
      field - the field
      longitude - longitude
      latitude - latitude
      radius - a string specifying the radius and it's unit
      Returns:
      the geo-location query
    • nearestNeighbor

      public static NearestNeighbor nearestNeighbor(String docVectorName, String queryVectorName)
      NearestNeighbor nearest neighbor https://docs.vespa.ai/en/reference/query-language-reference.html#nearestneighbor
      Parameters:
      docVectorName - the vector name defined in the vespa schema
      queryVectorName - the vector name in this query
      Returns:
      the nearest neighbor query