incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [3/6] Some more renaming in the thrift api and more documentation.
Date Mon, 19 Aug 2013 01:59:20 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/795468e3/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm b/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm
index c1c5b26..3683e56 100644
--- a/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm
+++ b/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm
@@ -449,9 +449,9 @@ sub write {
   return $xfer;
 }
 
-package Blur::SimpleQuery;
+package Blur::Query;
 use base qw(Class::Accessor);
-Blur::SimpleQuery->mk_accessors( qw( query rowQuery scoreType rowFilter recordFilter )
);
+Blur::Query->mk_accessors( qw( query rowQuery scoreType rowFilter recordFilter ) );
 
 sub new {
   my $classname = shift;
@@ -483,7 +483,7 @@ sub new {
 }
 
 sub getName {
-  return 'SimpleQuery';
+  return 'Query';
 }
 
 sub read {
@@ -542,7 +542,7 @@ sub read {
 sub write {
   my ($self, $output) = @_;
   my $xfer   = 0;
-  $xfer += $output->writeStructBegin('SimpleQuery');
+  $xfer += $output->writeStructBegin('Query');
   if (defined $self->{query}) {
     $xfer += $output->writeFieldBegin('query', TType::STRING, 1);
     $xfer += $output->writeString($self->{query});
@@ -575,18 +575,18 @@ sub write {
 
 package Blur::HighlightOptions;
 use base qw(Class::Accessor);
-Blur::HighlightOptions->mk_accessors( qw( simpleQuery preTag postTag ) );
+Blur::HighlightOptions->mk_accessors( qw( query preTag postTag ) );
 
 sub new {
   my $classname = shift;
   my $self      = {};
   my $vals      = shift || {};
-  $self->{simpleQuery} = undef;
+  $self->{query} = undef;
   $self->{preTag} = "<<<";
   $self->{postTag} = ">>>";
   if (UNIVERSAL::isa($vals,'HASH')) {
-    if (defined $vals->{simpleQuery}) {
-      $self->{simpleQuery} = $vals->{simpleQuery};
+    if (defined $vals->{query}) {
+      $self->{query} = $vals->{query};
     }
     if (defined $vals->{preTag}) {
       $self->{preTag} = $vals->{preTag};
@@ -618,8 +618,8 @@ sub read {
     SWITCH: for($fid)
     {
       /^1$/ && do{      if ($ftype == TType::STRUCT) {
-        $self->{simpleQuery} = new Blur::SimpleQuery();
-        $xfer += $self->{simpleQuery}->read($input);
+        $self->{query} = new Blur::Query();
+        $xfer += $self->{query}->read($input);
       } else {
         $xfer += $input->skip($ftype);
       }
@@ -648,9 +648,9 @@ sub write {
   my ($self, $output) = @_;
   my $xfer   = 0;
   $xfer += $output->writeStructBegin('HighlightOptions');
-  if (defined $self->{simpleQuery}) {
-    $xfer += $output->writeFieldBegin('simpleQuery', TType::STRUCT, 1);
-    $xfer += $self->{simpleQuery}->write($output);
+  if (defined $self->{query}) {
+    $xfer += $output->writeFieldBegin('query', TType::STRUCT, 1);
+    $xfer += $self->{query}->write($output);
     $xfer += $output->writeFieldEnd();
   }
   if (defined $self->{preTag}) {
@@ -1287,13 +1287,13 @@ sub write {
 
 package Blur::BlurQuery;
 use base qw(Class::Accessor);
-Blur::BlurQuery->mk_accessors( qw( simpleQuery facets selector useCacheIfPresent start
fetch minimumNumberOfResults maxQueryTime uuid userContext cacheResult startTime ) );
+Blur::BlurQuery->mk_accessors( qw( query facets selector useCacheIfPresent start fetch
minimumNumberOfResults maxQueryTime uuid userContext cacheResult startTime ) );
 
 sub new {
   my $classname = shift;
   my $self      = {};
   my $vals      = shift || {};
-  $self->{simpleQuery} = undef;
+  $self->{query} = undef;
   $self->{facets} = undef;
   $self->{selector} = undef;
   $self->{useCacheIfPresent} = 1;
@@ -1306,8 +1306,8 @@ sub new {
   $self->{cacheResult} = 1;
   $self->{startTime} = 0;
   if (UNIVERSAL::isa($vals,'HASH')) {
-    if (defined $vals->{simpleQuery}) {
-      $self->{simpleQuery} = $vals->{simpleQuery};
+    if (defined $vals->{query}) {
+      $self->{query} = $vals->{query};
     }
     if (defined $vals->{facets}) {
       $self->{facets} = $vals->{facets};
@@ -1366,8 +1366,8 @@ sub read {
     SWITCH: for($fid)
     {
       /^1$/ && do{      if ($ftype == TType::STRUCT) {
-        $self->{simpleQuery} = new Blur::SimpleQuery();
-        $xfer += $self->{simpleQuery}->read($input);
+        $self->{query} = new Blur::Query();
+        $xfer += $self->{query}->read($input);
       } else {
         $xfer += $input->skip($ftype);
       }
@@ -1464,9 +1464,9 @@ sub write {
   my ($self, $output) = @_;
   my $xfer   = 0;
   $xfer += $output->writeStructBegin('BlurQuery');
-  if (defined $self->{simpleQuery}) {
-    $xfer += $output->writeFieldBegin('simpleQuery', TType::STRUCT, 1);
-    $xfer += $self->{simpleQuery}->write($output);
+  if (defined $self->{query}) {
+    $xfer += $output->writeFieldBegin('query', TType::STRUCT, 1);
+    $xfer += $self->{query}->write($output);
     $xfer += $output->writeFieldEnd();
   }
   if (defined $self->{facets}) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/795468e3/distribution/src/main/scripts/interface/gen-rb/blur.rb
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-rb/blur.rb b/distribution/src/main/scripts/interface/gen-rb/blur.rb
index 030a20d..d39b967 100644
--- a/distribution/src/main/scripts/interface/gen-rb/blur.rb
+++ b/distribution/src/main/scripts/interface/gen-rb/blur.rb
@@ -152,13 +152,13 @@ module Blur
         raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT,
'schema failed: unknown result')
       end
 
-      def parseQuery(table, simpleQuery)
-        send_parseQuery(table, simpleQuery)
+      def parseQuery(table, query)
+        send_parseQuery(table, query)
         return recv_parseQuery()
       end
 
-      def send_parseQuery(table, simpleQuery)
-        send_message('parseQuery', ParseQuery_args, :table => table, :simpleQuery =>
simpleQuery)
+      def send_parseQuery(table, query)
+        send_message('parseQuery', ParseQuery_args, :table => table, :query => query)
       end
 
       def recv_parseQuery()
@@ -622,7 +622,7 @@ module Blur
         args = read_args(iprot, ParseQuery_args)
         result = ParseQuery_result.new()
         begin
-          result.success = @handler.parseQuery(args.table, args.simpleQuery)
+          result.success = @handler.parseQuery(args.table, args.query)
         rescue ::Blur::BlurException => ex
           result.ex = ex
         end
@@ -1189,13 +1189,13 @@ module Blur
     class ParseQuery_args
       include ::Thrift::Struct, ::Thrift::Struct_Union
       TABLE = 1
-      SIMPLEQUERY = 2
+      QUERY = 2
 
       FIELDS = {
         # the table name.
         TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
         # the query to parse.
-        SIMPLEQUERY => {:type => ::Thrift::Types::STRUCT, :name => 'simpleQuery',
:class => ::Blur::SimpleQuery}
+        QUERY => {:type => ::Thrift::Types::STRUCT, :name => 'query', :class =>
::Blur::Query}
       }
 
       def struct_fields; FIELDS; end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/795468e3/distribution/src/main/scripts/interface/gen-rb/blur_types.rb
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-rb/blur_types.rb b/distribution/src/main/scripts/interface/gen-rb/blur_types.rb
index f1714ad..49c61fb 100644
--- a/distribution/src/main/scripts/interface/gen-rb/blur_types.rb
+++ b/distribution/src/main/scripts/interface/gen-rb/blur_types.rb
@@ -168,9 +168,9 @@ module Blur
     ::Thrift::Struct.generate_accessors self
   end
 
-  # The SimpleQuery object holds the query string (normal Lucene syntax),
+  # The Query object holds the query string (normal Lucene syntax),
 # filters and type of scoring (used when super query is on).
-  class SimpleQuery
+  class Query
     include ::Thrift::Struct, ::Thrift::Struct_Union
     QUERY = 1
     ROWQUERY = 2
@@ -187,7 +187,8 @@ module Blur
       # The scoring type, see the document on ScoreType for explanation of each score type.
       SCORETYPE => {:type => ::Thrift::Types::I32, :name => 'scoreType', :default
=>       0, :enum_class => ::Blur::ScoreType},
       # The Row filter (normal Lucene syntax), is a filter performed
-# after the join to filter out entire Rows from the results.
+# after the join to filter out entire Rows from the results.  This
+# field is ignored when rowQuery is false.
       ROWFILTER => {:type => ::Thrift::Types::STRING, :name => 'rowFilter'},
       # The Record filter (normal Lucene syntax), is a filter performed
 # before the join to filter out Records from the results.
@@ -208,17 +209,17 @@ module Blur
   # The HighlightOptions controls how the data is fetched and returned.
   class HighlightOptions
     include ::Thrift::Struct, ::Thrift::Struct_Union
-    SIMPLEQUERY = 1
+    QUERY = 1
     PRETAG = 2
     POSTTAG = 3
 
     FIELDS = {
       # The original query is required if used in the Blur.fetchRow call.  If
-# the highlightOptions is used in a call to Blur.query then the SimpleQuery
-# passed into the call via the BlurQuery will be used if this simpleQuery is
+# the highlightOptions is used in a call to Blur.query then the Query
+# passed into the call via the BlurQuery will be used if this query is
 # null.  So that means if you use highlighting from the query call you can
 # leave this attribute null and it will default to the normal behavior.
-      SIMPLEQUERY => {:type => ::Thrift::Types::STRUCT, :name => 'simpleQuery',
:class => ::Blur::SimpleQuery},
+      QUERY => {:type => ::Thrift::Types::STRUCT, :name => 'query', :class =>
::Blur::Query},
       # The pre tag is the tag that marks the beginning of the highlighting.
       PRETAG => {:type => ::Thrift::Types::STRING, :name => 'preTag', :default =>
%q"<<<"},
       # The post tag is the tag that marks the end of the highlighting.
@@ -385,7 +386,7 @@ module Blur
 # with the query options.
   class BlurQuery
     include ::Thrift::Struct, ::Thrift::Struct_Union
-    SIMPLEQUERY = 1
+    QUERY = 1
     FACETS = 3
     SELECTOR = 4
     USECACHEIFPRESENT = 6
@@ -400,7 +401,7 @@ module Blur
 
     FIELDS = {
       # The query information.
-      SIMPLEQUERY => {:type => ::Thrift::Types::STRUCT, :name => 'simpleQuery',
:class => ::Blur::SimpleQuery},
+      QUERY => {:type => ::Thrift::Types::STRUCT, :name => 'query', :class =>
::Blur::Query},
       # A list of Facets to execute with the given query.
       FACETS => {:type => ::Thrift::Types::LIST, :name => 'facets', :element =>
{:type => ::Thrift::Types::STRUCT, :class => ::Blur::Facet}},
       # Selector is used to fetch data in the search results, if null only location ids will
be fetched.

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/795468e3/docs/Blur.html
----------------------------------------------------------------------
diff --git a/docs/Blur.html b/docs/Blur.html
index 9edd964..d611254 100644
--- a/docs/Blur.html
+++ b/docs/Blur.html
@@ -67,7 +67,7 @@ limitations under the License.
 <li><a href="#Struct_Column">Column</a></li>
 <li><a href="#Struct_Record">Record</a></li>
 <li><a href="#Struct_Row">Row</a></li>
-<li><a href="#Struct_SimpleQuery">SimpleQuery</a></li>
+<li><a href="#Struct_Query">Query</a></li>
 <li><a href="#Struct_HighlightOptions">HighlightOptions</a></li>
 <li><a href="#Struct_Selector">Selector</a></li>
 <li><a href="#Struct_FetchRowResult">FetchRowResult</a></li>
@@ -268,7 +268,7 @@ reflect the paged records from the selector.
 through records of a row, this count will reflect the entire row.
 </td><td>default</td><td></td></tr>
 </table><br/>Rows contain a list of records.
-<br/></p></section><section><div class="page-header"><h3
id="Struct_SimpleQuery">Struct: SimpleQuery</h3></div><p class="lead">
+<br/></p></section><section><div class="page-header"><h3
id="Struct_Query">Struct: Query</h3></div><p class="lead">
 <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default
value</th></thead>
 <tr><td>1</td><td>query</td><td><code>string</code></td><td>A
Lucene syntax based query.
 </td><td>default</td><td></td></tr>
@@ -278,18 +278,19 @@ Records (joining records in some cases) and the result will be Rows
(groupings o
 <tr><td>3</td><td>scoreType</td><td><code><a
href="Blur.html#Enum_ScoreType">ScoreType</a></code></td><td>The
scoring type, see the document on ScoreType for explanation of each score type.
 </td><td>default</td><td>UNKNOWN</td></tr>
 <tr><td>4</td><td>rowFilter</td><td><code>string</code></td><td>The
Row filter (normal Lucene syntax), is a filter performed
-after the join to filter out entire Rows from the results.
+after the join to filter out entire Rows from the results.  This
+field is ignored when rowQuery is false.
 </td><td>default</td><td></td></tr>
 <tr><td>5</td><td>recordFilter</td><td><code>string</code></td><td>The
Record filter (normal Lucene syntax), is a filter performed
 before the join to filter out Records from the results.
 </td><td>default</td><td></td></tr>
-</table><br/>The SimpleQuery object holds the query string (normal Lucene syntax),
+</table><br/>The Query object holds the query string (normal Lucene syntax),
 filters and type of scoring (used when super query is on).
 <br/></p></section><section><div class="page-header"><h3
id="Struct_HighlightOptions">Struct: HighlightOptions</h3></div><p class="lead">
 <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default
value</th></thead>
-<tr><td>1</td><td>simpleQuery</td><td><code><a
href="Blur.html#Struct_SimpleQuery">SimpleQuery</a></code></td><td>The
original query is required if used in the Blur.fetchRow call.  If
-the highlightOptions is used in a call to Blur.query then the SimpleQuery
-passed into the call via the BlurQuery will be used if this simpleQuery is
+<tr><td>1</td><td>query</td><td><code><a href="Blur.html#Struct_Query">Query</a></code></td><td>The
original query is required if used in the Blur.fetchRow call.  If
+the highlightOptions is used in a call to Blur.query then the Query
+passed into the call via the BlurQuery will be used if this query is
 null.  So that means if you use highlighting from the query call you can
 leave this attribute null and it will default to the normal behavior.
 </td><td>default</td><td></td></tr>
@@ -368,7 +369,7 @@ because it sums the answers from the shard servers.
 </table><br/>Blur facet.
 <br/></p></section><section><div class="page-header"><h3
id="Struct_BlurQuery">Struct: BlurQuery</h3></div><p class="lead">
 <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default
value</th></thead>
-<tr><td>1</td><td>simpleQuery</td><td><code><a
href="Blur.html#Struct_SimpleQuery">SimpleQuery</a></code></td><td>The
query information.
+<tr><td>1</td><td>query</td><td><code><a href="Blur.html#Struct_Query">Query</a></code></td><td>The
query information.
 </td><td>default</td><td></td></tr>
 <tr><td>3</td><td>facets</td><td><code>list&lt;<code><a
href="Blur.html#Struct_Facet">Facet</a></code>&gt;</code></td><td>A
list of Facets to execute with the given query.
 </td><td>default</td><td></td></tr>
@@ -637,14 +638,14 @@ throws <code><a href="Blur.html#Struct_BlurException">BlurException</a></code>
 </td></tr>
 </table></p></section><section><div class="page-header"><h4
id="Fn_Blur_parseQuery">Function: Blur.parseQuery</h4></div><p class="lead">
 <pre><code>string</code> parseQuery(<code>string</code> table,
-<code><a href="Blur.html#Struct_SimpleQuery">SimpleQuery</a></code>
simpleQuery)
+<code><a href="Blur.html#Struct_Query">Query</a></code> query)
 throws <code><a href="Blur.html#Struct_BlurException">BlurException</a></code>
 </pre>Parses the given query and return the string represents the query.
 @return string representation of the parsed query.
 <br/><br/><h4 id="Parameters_Blur_parseQuery">Parameters</h4>
 <table class="table-bordered table-striped table-condensed"><thead><th>Name</th><th>Description</th></thead><tr><td>table</td><td>the
table name.
 </td></tr>
-<tr><td>simpleQuery</td><td>the query to parse.
+<tr><td>query</td><td>the query to parse.
 </td></tr>
 </table></p></section><section><div class="page-header"><h4
id="Fn_Blur_tableStats">Function: Blur.tableStats</h4></div><p class="lead">
 <pre><code><a href="Blur.html#Struct_TableStats">TableStats</a></code>
tableStats(<code>string</code> table)

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/795468e3/docs/data-model.html
----------------------------------------------------------------------
diff --git a/docs/data-model.html b/docs/data-model.html
index 6eeca72..f82c48a 100644
--- a/docs/data-model.html
+++ b/docs/data-model.html
@@ -61,7 +61,9 @@
               <li>
 				<a href="#querying">Querying</a>
 				<ul class="nav">
-                  <li><a href="#string_query">String / Text</a></li>
+				  <li><a href="#row_query">Row Query</a></li>
+				  <li><a href="#test_query">Text</a></li>
+                  <li><a href="#string_query">String</a></li>
                   <li><a href="#numeric_query">Numeric</a></li>
                   <li><a href="#spatial_query">Spatial</a></li>
                 </ul>
@@ -76,12 +78,13 @@
                   <li><a href="#float_type">Float</a></li>
                   <li><a href="#double_type">Double</a></li>
                   <li><a href="#stored_type">Stored</a></li>
-	  			  <a href="#spatial_type">Spatial</a>
-				  <ul class="nav">
-                    <li><a href="#spatial_pointvector">Point Vector</a></li>
-                    <li><a href="#spatial_termprefix">Term Prefix</a></li>
-                    <li><a href="#spatial_recursiveprefix">Recursive Prefix</a></li>
-                  </ul>
+	  			  <li><a href="#spatial_type">Spatial</a>
+				    <ul class="nav">
+                      <li><a href="#spatial_pointvector">&nbsp;&nbsp;Point
Vector</a></li>
+                      <li><a href="#spatial_termprefix">&nbsp;&nbsp;Term
Prefix</a></li>
+                      <li><a href="#spatial_recursiveprefix">&nbsp;&nbsp;Recursive
Prefix</a></li>
+                    </ul>
+                  </li>
                 </ul>
 			  </li>
             </ul>
@@ -153,7 +156,83 @@
           <section>
             <div class="page-header">
               <h1 id="querying">Querying</h1>
-              <p class="lead">TODO</p>
+				<p>
+				All queries follow the basic Lucene query syntax see (<a href="http://lucene.apache.org/core/4_4_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html">http://lucene.apache.org/core/4_4_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html</a>)
+				for an extensive explanation on the syntax.
+				</p>
+				<p>
+				All queries can have boolean logic like:
+				<pre><code class="json">+docs.body:hadoop +docs.author:jon</code></pre>
+				Which is the same as:
+				<pre><code class="json">docs.body:hadoop AND docs.author:jon</code></pre>
+				</p>
+              <h3 id="row_query">Row Queries</h3>
+
+<p>
+Row queries allow you to execute queries across Records within the same Row.  Row queries
are a similar idea to an inner join.
+Let's say you want to find all the Rows that contain a Record with the family &quot;author&quot;
and has a &quot;name&quot; Column that has that contains a term &quot;Jon&quot;
and another Record with the family &quot;docs&quot; and has a &quot;body&quot;
Column with a term of &quot;Hadoop&quot;.
+<pre><code class="json">+&lt;author.name:Jon&gt; +&lt;docs.body:Hadoop&gt;</code></pre>
+</p>
+
+              <h3 id="text_query">Text</h3>
+<p>Text fields are analyzed with Lucene's standard analyzers, which mean that the string
is broken down into terms
+and the terms capitalization is removed and well as any special punctuation.  See Lucene's
documentation for further explanation.
+</p>
+              <h4>Examples:</h4>
+<p>
+To run a query to find all the rows that contain a column with a term of &quot;hadoop&quot;
where the family is &quot;docs&quot; and the column is  &quot;body&quot;.
+<pre><code class="json">docs.body:hadoop</code></pre>
+</p>
+<p>
+To run a query to find all the rows that contain a column with a term of &quot;hadoop&quot;
and &quot;awesome&quot; where the family is &quot;docs&quot; and the column
is &quot;body&quot;.
+<pre><code class="json">docs.body:(+hadoop +awesome)</code></pre>
+</p>
+<p>
+To run a query to find all the rows that contain a column with a phrase of &quot;hadoop
is awesome&quot; where the family is &quot;docs&quot; and the column is &quot;body&quot;.
+<pre><code class="json">docs.body:&quot;hadoop is awesome&quot;</code></pre>
+</p>
+<p>
+To run a query to find all the rows that contain a column with a word of &quot;hadoop&quot;
and we want to deal with misspellings (or a Fuzzy query) where the family is &quot;docs&quot;
and the column is &quot;body&quot;.
+<pre><code class="json">docs.body:hadoop~</code></pre>
+</p>
+<p>
+To run a query to find all the rows that contain a column with a word that matches a wildcard
pattern of &quot;h*d?op&quot; where the family is &quot;docs&quot; and the
column is &quot;body&quot;.
+<pre><code class="json">docs.body:h*d?op</code></pre>
+</p>
+
+              <h3 id="string_query">String</h3>
+              <p>TODO</p>
+              <h3 id="numeric_query">Numeric</h3>
+              <p>TODO</p>
+              <h3 id="spatial_query">Spatial</h3>
+              <p>TODO</p>
+            </div>
+          </section>
+          <section>
+            <div class="page-header">
+              <h1 id="types">Types</h1>
+              <h3 id="text_type">Text</h3>
+              <p>TODO</p>
+              <h3 id="string_type">String</h3>
+              <p>TODO</p>
+              <h3 id="long_type">Long</h3>
+              <p>TODO</p>
+              <h3 id="int_type">Integer</h3>
+              <p>TODO</p>
+              <h3 id="float_type">Float</h3>
+              <p>TODO</p>
+              <h3 id="double_type">Double</h3>
+              <p>TODO</p>
+              <h3 id="stored_type">Stored</h3>
+              <p>TODO</p>
+              <h3 id="spatial_type">Spatial</h3>
+              <p>TODO</p>
+              <h4 id="spatial_pointvector">Point Vector</h4>
+              <p>TODO</p>
+              <h4 id="spatial_termprefix">Term Prefix</h4>
+              <p>TODO</p>
+              <h4 id="spatial_recursiveprefix">Recursive Prefix</h4>
+              <p>TODO</p>
             </div>
           </section>
         </div>


Mime
View raw message