Engine
analyzers
lupyne.engine.analyzers.TokenStream
Bases: TokenStream
TokenStream mixin with support for iteration and attributes cached as properties.
Source code in lupyne/engine/analyzers.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
charTerm: str
property
writable
term text
offset: tuple
property
writable
start and stop character offset
payload
property
writable
payload bytes
positionIncrement: int
property
writable
position relative to the previous token
type: str
property
writable
lexical type
lupyne.engine.analyzers.TokenFilter
Bases: PythonTokenFilter
, TokenStream
Create an iterable lucene TokenFilter from a TokenStream.
Subclass and override incrementToken.
Source code in lupyne/engine/analyzers.py
78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
incrementToken()
Advance to next token and return whether the stream is not empty.
Source code in lupyne/engine/analyzers.py
88 89 90 |
|
lupyne.engine.analyzers.Analyzer
Bases: PythonAnalyzer
Return a lucene Analyzer which chains together a tokenizer and filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tokenizer
|
Callable
|
lucene Tokenizer class or callable, called with no args |
required |
*filters
|
Callable
|
lucene TokenFilter classes or callables, successively called on input tokens |
()
|
Source code in lupyne/engine/analyzers.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
highlight(query, field, content, count=1)
Return highlighted content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
Query
|
lucene Query |
required |
field
|
str
|
field name |
required |
content
|
str
|
text |
required |
count
|
int
|
optional maximum number of passages |
1
|
Source code in lupyne/engine/analyzers.py
159 160 161 162 163 164 165 166 167 168 169 |
|
parse(query, field='', op='', parser=None, **attrs)
Return parsed lucene Query.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
query string |
required |
field
|
default query field name, sequence of names, or boost mapping |
''
|
|
op
|
default query operator ('or', 'and') |
''
|
|
parser
|
custom PythonQueryParser class |
None
|
|
**attrs
|
additional attributes to set on the parser |
{}
|
Source code in lupyne/engine/analyzers.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
standard(*filters)
classmethod
Return equivalent of StandardAnalyzer with additional filters.
Source code in lupyne/engine/analyzers.py
105 106 107 108 |
|
tokens(text, field=None)
Return lucene TokenStream from text.
Source code in lupyne/engine/analyzers.py
126 127 128 |
|
whitespace(*filters)
classmethod
Return equivalent of WhitespaceAnalyzer with additional filters.
Source code in lupyne/engine/analyzers.py
110 111 112 113 |
|
indexers
lupyne.engine.indexers.IndexReader
Delegated lucene IndexReader, with a mapping interface of ids to document objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reader
|
lucene IndexReader |
required |
Source code in lupyne/engine/indexers.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
directory: store.Directory
property
reader's lucene Directory
fieldinfos: dict
property
mapping of field names to lucene FieldInfos
path: str
property
FSDirectory path
readers: Iterator
property
segment readers
segments: dict
property
segment filenames with document counts
timestamp: float
property
timestamp of reader's last commit
complete(name, prefix, count)
Return autocomplete suggestions for word prefix.
Source code in lupyne/engine/indexers.py
160 161 162 163 |
|
copy(dest, query=None, exclude=None, merge=0)
Copy the index to the destination directory.
Optimized to use hard links if the destination is a file system path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dest
|
destination directory path or lucene Directory |
required | |
query
|
Query
|
optional lucene Query to select documents |
None
|
exclude
|
Query
|
optional lucene Query to exclude documents |
None
|
merge
|
int
|
optionally merge into maximum number of segments |
0
|
Source code in lupyne/engine/indexers.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
dictionary(name, *args)
Return lucene Dictionary, suitable for spellcheckers.
Source code in lupyne/engine/indexers.py
140 141 142 143 |
|
docs(name, value, counts=False)
Generate doc ids which contain given term, optionally with frequency counts.
Source code in lupyne/engine/indexers.py
246 247 248 249 250 251 252 |
|
docvalues(name, type=None)
Return chained lucene DocValues, suitable for custom sorting or grouping.
Note multi-valued DocValues aren't thread-safe and only supported ordered iteration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
field name |
required |
type
|
int or float for converting values |
None
|
Source code in lupyne/engine/indexers.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
|
morelikethis(doc, *fields, **attrs)
Return MoreLikeThis query for document.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc
|
document id or text |
required | |
*fields
|
document fields to use, optional for termvectors |
()
|
|
**attrs
|
additional attributes to set on the morelikethis object |
{}
|
Source code in lupyne/engine/indexers.py
297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
positions(name, value, payloads=False, offsets=False)
Generate doc ids and positions which contain given term.
Optionally with offsets, or only ones with payloads.
Source code in lupyne/engine/indexers.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
|
positionvector(id, field, offsets=False)
Generate terms and positions for given doc id and field, optionally with character offsets.
Source code in lupyne/engine/indexers.py
286 287 288 289 290 291 292 293 294 295 |
|
sortfield(name, type=None, reverse=False)
Return lucene SortField, deriving the the type from FieldInfos if necessary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
field name |
required |
type
|
int, float, or name compatible with SortField constants |
None
|
|
reverse
|
reverse flag used with sort |
False
|
Source code in lupyne/engine/indexers.py
165 166 167 168 169 170 171 172 173 174 175 176 |
|
suggest(name, value, count=1, **attrs)
Return spelling suggestions from DirectSpellChecker.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
field name |
required |
value
|
term |
required | |
count
|
int
|
maximum number of suggestions |
1
|
**attrs
|
DirectSpellChecker options |
{}
|
Source code in lupyne/engine/indexers.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
terms(name, value='', stop='', counts=False, distance=0, prefix=0)
Generate a slice of term values, optionally with frequency counts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
field name |
required |
value
|
term prefix, start value (given stop), or fuzzy value (given distance) |
''
|
|
stop
|
optional upper bound for range terms |
''
|
|
counts
|
include frequency counts |
False
|
|
distance
|
maximum edit distance for fuzzy terms |
0
|
|
prefix
|
prefix length for fuzzy terms |
0
|
Source code in lupyne/engine/indexers.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
|
termvector(id, field, counts=False)
Generate terms for given doc id and field, optionally with frequency counts.
Source code in lupyne/engine/indexers.py
281 282 283 284 |
|
lupyne.engine.indexers.IndexSearcher
Bases: IndexSearcher
, IndexReader
Inherited lucene IndexSearcher, with a mixed-in IndexReader.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
directory path, lucene Directory, or lucene IndexReader |
required | |
analyzer
|
lucene Analyzer, default StandardAnalyzer |
None
|
Source code in lupyne/engine/indexers.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
|
highlighter: uhighlight.UnifiedHighlighter
property
lucene UnifiedHighlighter
count(*query, **options)
Return number of hits for given query or term.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*query
|
search compatible query, or optimally a name and value |
()
|
|
**options
|
additional search options |
{}
|
Source code in lupyne/engine/indexers.py
388 389 390 391 392 393 394 395 396 397 |
|
facets(query, *fields, **query_map)
Return mapping of document counts for the intersection with each facet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
query string or lucene Query |
required | |
*fields
|
str
|
field names for lucene GroupingSearch |
()
|
**query_map
|
dict
|
|
{}
|
Source code in lupyne/engine/indexers.py
450 451 452 453 454 455 456 457 458 459 460 461 462 |
|
get(id, *fields)
Return Document with only selected fields loaded.
Source code in lupyne/engine/indexers.py
348 349 350 |
|
groupby(field, query, count=None, start=0, **attrs)
Return Hits grouped by field using a GroupingSearch.
Source code in lupyne/engine/indexers.py
464 465 466 467 468 469 |
|
match(document, *queries)
Generate scores for all queries against a given document mapping.
Source code in lupyne/engine/indexers.py
471 472 473 474 475 476 477 |
|
reopen()
Return current IndexSearcher.
Only creates a new one if necessary.
Source code in lupyne/engine/indexers.py
332 333 334 335 336 337 338 339 340 341 342 343 |
|
search(query=None, count=None, sort=None, reverse=False, scores=False, mincount=1000, **parser)
Run query and return Hits.
Note
changed in version 2.3: maxscore option removed; use Hits.maxscore property
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
query string or lucene Query |
None
|
|
count
|
maximum number of hits to retrieve |
None
|
|
sort
|
lucene Sort parameters |
None
|
|
reverse
|
reverse flag used with sort |
False
|
|
scores
|
compute scores for candidate results when sorting |
False
|
|
mincount
|
total hit count accuracy threshold |
1000
|
|
**parser
|
parse` options |
{}
|
Source code in lupyne/engine/indexers.py
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
|
spans(query, positions=False)
Generate docs with occurrence counts for a span query.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
SpanQuery
|
lucene SpanQuery |
required |
positions
|
optionally include slice positions instead of counts |
False
|
Source code in lupyne/engine/indexers.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|
lupyne.engine.indexers.MultiSearcher
Bases: IndexSearcher
IndexSearcher with underlying lucene MultiReader.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reader
|
directory paths, Directories, IndexReaders, or a single MultiReader |
required | |
analyzer
|
lucene Analyzer, default StandardAnalyzer |
None
|
Source code in lupyne/engine/indexers.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
|
lupyne.engine.indexers.IndexWriter
Bases: IndexWriter
Inherited lucene IndexWriter.
Supports setting fields parameters explicitly, so documents can be represented as dictionaries.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
directory path or lucene Directory |
required | |
mode
|
str
|
file mode (rwa), except updating (+) is implied |
'a'
|
analyzer
|
lucene Analyzer, default StandardAnalyzer |
None
|
|
version
|
lucene Version argument passed to IndexWriterConfig, default is latest |
None
|
|
**attrs
|
additional attributes to set on IndexWriterConfig |
{}
|
Source code in lupyne/engine/indexers.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 |
|
__iadd__(directory)
Add directory (or reader, searcher, writer) to index.
Source code in lupyne/engine/indexers.py
604 605 606 607 608 |
|
add(document=(), **terms)
Add document to index with optional boost.
Source code in lupyne/engine/indexers.py
575 576 577 |
|
check(directory, repair=False)
classmethod
Check and optionally fix unlocked index, returning lucene CheckIndex.Status.
Source code in lupyne/engine/indexers.py
544 545 546 547 548 549 550 551 552 |
|
delete(*query, **options)
Remove documents which match given query or term.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*query
|
search compatible query, or optimally a name and value |
()
|
|
**options
|
additional parse options |
{}
|
Source code in lupyne/engine/indexers.py
594 595 596 597 598 599 600 601 602 |
|
document(items=(), **terms)
Return lucene Document from mapping of field names to one or multiple values.
Source code in lupyne/engine/indexers.py
565 566 567 568 569 570 571 572 573 |
|
set(name, cls=Field, **settings)
Assign settings to field name and return the field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
registered name of field |
required |
cls
|
optional Field constructor |
Field
|
|
**settings
|
stored, indexed, etc. options compatible with Field |
{}
|
Source code in lupyne/engine/indexers.py
554 555 556 557 558 559 560 561 562 563 |
|
snapshot()
Return context manager of an index commit snapshot.
Source code in lupyne/engine/indexers.py
610 611 612 613 614 615 616 617 |
|
update(name, value='', document=(), **terms)
Atomically delete documents which match given term and add the new document.
Source code in lupyne/engine/indexers.py
579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
|
lupyne.engine.indexers.Indexer
Bases: IndexWriter
An all-purpose interface to an index.
Creates an IndexWriter with a delegated IndexSearcher.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nrt
|
optionally use a near real-time searcher |
False
|
Source code in lupyne/engine/indexers.py
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 |
|
commit(merge=False)
Commit writes and refresh searcher.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
merge
|
int
|
merge segments with deletes, or optionally specify maximum number of segments |
False
|
Source code in lupyne/engine/indexers.py
664 665 666 667 668 669 670 671 672 673 674 675 676 677 |
|
refresh()
Store refreshed searcher from reopening.
Source code in lupyne/engine/indexers.py
660 661 662 |
|
documents
lupyne.engine.documents.Document
Bases: dict
Multimapping of field names to values, but default getters return the first value.
Source code in lupyne/engine/documents.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
|
dict(*names, **defaults)
Return dict representation of document.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*names
|
str
|
names of multi-valued fields to return as a list |
()
|
**defaults
|
include only given fields, using default values as necessary |
{}
|
Source code in lupyne/engine/documents.py
300 301 302 303 304 305 306 307 308 |
|
getlist(name)
Return list of all values for given field.
Source code in lupyne/engine/documents.py
296 297 298 |
|
lupyne.engine.documents.Hit
Bases: Document
A Document from a search result, with :attr:id
, :attr:score
, and optional :attr:sortkeys
.
Note
changed in version 2.4: keys renamed to :attr:sortkeys
Source code in lupyne/engine/documents.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
|
dict(*names, **defaults)
Return dict representation of document with id, score, and any sort keys.
Source code in lupyne/engine/documents.py
323 324 325 326 327 328 329 |
|
lupyne.engine.documents.Hits
Search results: lazily evaluated and memory efficient.
Provides a read-only sequence interface to hit objects.
Note
changed in version 2.3: maxscore option removed; computed property instead
Parameters:
Name | Type | Description | Default |
---|---|---|---|
searcher
|
IndexSearcher which can retrieve documents |
required | |
scoredocs
|
Sequence
|
lucene ScoreDocs |
required |
count
|
total number of hits; float indicates estimate |
0
|
|
fields
|
optional field selectors |
None
|
Source code in lupyne/engine/documents.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
|
maxscore: float
property
max score of present hits; not necessarily of all matches
docvalues(field, type=None)
Return mapping of docs to docvalues.
Source code in lupyne/engine/documents.py
401 402 403 |
|
filter(func)
Return Hits filtered by function applied to doc ids.
Source code in lupyne/engine/documents.py
427 428 429 430 |
|
groupby(func, count=None, docs=None)
Return ordered list of Hits grouped by value of function applied to doc ids.
Optionally limit the number of groups and docs per group.
Source code in lupyne/engine/documents.py
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 |
|
highlights(query, **fields)
Generate highlighted fields for each hit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
Query
|
lucene Query |
required |
**fields
|
int
|
mapping of fields to maxinum number of passages |
{}
|
Source code in lupyne/engine/documents.py
388 389 390 391 392 393 394 395 396 397 398 399 |
|
items()
Generate zipped ids and scores.
Source code in lupyne/engine/documents.py
384 385 386 |
|
select(*fields)
Only load selected fields.
Source code in lupyne/engine/documents.py
354 355 356 |
|
sorted(key, reverse=False)
Return Hits sorted by key function applied to doc ids.
Source code in lupyne/engine/documents.py
432 433 434 435 |
|
lupyne.engine.documents.Groups
Sequence of grouped Hits.
Source code in lupyne/engine/documents.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
|
facets
property
mapping of field values and counts
lupyne.engine.documents.GroupingSearch
Bases: GroupingSearch
Inherited lucene GroupingSearch with optimized faceting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field
|
str
|
unique field name to group by |
required |
sort
|
lucene Sort to order groups and docs |
None
|
|
cache
|
use unlimited caching |
True
|
|
**attrs
|
additional attributes to set |
{}
|
Source code in lupyne/engine/documents.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
|
search(searcher, query, count=None, start=0)
Run query and return Groups.
Source code in lupyne/engine/documents.py
495 496 497 498 499 500 501 502 503 504 505 |
|
lupyne.engine.documents.Field
Bases: FieldType
Saved parameters which can generate lucene Fields given values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
name of field |
required |
Source code in lupyne/engine/documents.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
settings: dict
property
dict representation of settings
String(name, tokenized=False, omitNorms=True, indexOptions='DOCS', **settings)
classmethod
Return Field with default settings for strings.
Source code in lupyne/engine/documents.py
73 74 75 76 77 78 79 |
|
Text(name, indexOptions='DOCS_AND_FREQS_AND_POSITIONS', **settings)
classmethod
Return Field with default settings for text.
Source code in lupyne/engine/documents.py
81 82 83 84 |
|
items(*values)
Generate lucene Fields suitable for adding to a document.
Source code in lupyne/engine/documents.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
lupyne.engine.documents.NestedField
Bases: Field
Field which indexes every component into its own field.
Original value may be stored for convenience.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sep
|
str
|
field separator used on name and values |
'.'
|
Source code in lupyne/engine/documents.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
items(*values)
Generate indexed component fields.
Source code in lupyne/engine/documents.py
144 145 146 147 148 149 150 151 |
|
prefix(value)
Return prefix query of the closest possible prefixed field.
Source code in lupyne/engine/documents.py
153 154 155 156 |
|
range(start, stop, lower=True, upper=False)
Return range query of the closest possible prefixed field.
Source code in lupyne/engine/documents.py
158 159 160 161 |
|
values(value)
Generate component field values in order.
Source code in lupyne/engine/documents.py
138 139 140 141 142 |
|
lupyne.engine.documents.DateTimeField
Bases: Field
Field which indexes datetimes as Point fields of timestamps.
Supports datetimes, dates, and any prefix of time tuples.
Source code in lupyne/engine/documents.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
duration(date, days=0, **delta)
Return date range query within time span of date.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date
|
origin date or tuple |
required | |
days
|
**delta
|
: timedelta parameters |
0
|
Source code in lupyne/engine/documents.py
197 198 199 200 201 202 203 204 205 206 207 |
|
items(*dates)
Generate lucene NumericFields of timestamps.
Source code in lupyne/engine/documents.py
180 181 182 |
|
prefix(date)
Return range query which matches the date prefix.
Source code in lupyne/engine/documents.py
189 190 191 192 193 194 195 |
|
range(start, stop, **inclusive)
Return NumericRangeQuery of timestamps.
Source code in lupyne/engine/documents.py
184 185 186 187 |
|
timestamp(date)
classmethod
Return utc timestamp from date or time tuple.
Source code in lupyne/engine/documents.py
173 174 175 176 177 178 |
|
within(days=0, weeks=0, tz=None, **delta)
Return date range query within current time and delta.
If the delta is an exact number of days, then dates will be used.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
days
|
weeks
|
number of days to offset from today |
0
|
tz
|
optional timezone |
None
|
|
**delta
|
additional timedelta parameters |
{}
|
Source code in lupyne/engine/documents.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
lupyne.engine.documents.ShapeField
Field which indexes geometries: LatLon or XY.
Source code in lupyne/engine/documents.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
contains(*shapes)
Return shape query with contains
relation.
Source code in lupyne/engine/documents.py
265 266 267 |
|
disjoint(*shapes)
Return shape query with disjoint
relation.
Source code in lupyne/engine/documents.py
269 270 271 |
|
distances(point)
Return distance SortField.
Source code in lupyne/engine/documents.py
247 248 249 250 251 |
|
intersects(*shapes)
Return shape query with intersects
relation.
Source code in lupyne/engine/documents.py
273 274 275 |
|
items(*shapes)
Generate lucene shape fields from geometries.
Source code in lupyne/engine/documents.py
238 239 240 241 242 243 244 245 |
|
within(*shapes)
Return shape query with within
relation.
Source code in lupyne/engine/documents.py
277 278 279 |
|
queries
lupyne.engine.queries.Query
Inherited lucene Query, with dynamic base class acquisition.
Uses class methods and operator overloading for convenient query construction.
Source code in lupyne/engine/queries.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
|
__and__(other)
+self +other
Source code in lupyne/engine/queries.py
185 186 187 |
|
__neg__()
-self
Source code in lupyne/engine/queries.py
181 182 183 |
|
__or__(other)
self other
Source code in lupyne/engine/queries.py
192 193 194 |
|
__pos__()
+self
Source code in lupyne/engine/queries.py
177 178 179 |
|
__sub__(other)
self -other
Source code in lupyne/engine/queries.py
199 200 201 202 203 204 |
|
all(*queries, **terms)
classmethod
Return lucene BooleanQuery with MUST clauses from queries and terms.
Source code in lupyne/engine/queries.py
47 48 49 50 |
|
alldocs()
classmethod
Return lucene MatchAllDocsQuery.
Source code in lupyne/engine/queries.py
118 119 120 121 |
|
any(*queries, **terms)
classmethod
Return lucene BooleanQuery with SHOULD clauses from queries and terms.
Source code in lupyne/engine/queries.py
42 43 44 45 |
|
boost(value)
Return lucene BoostQuery.
Source code in lupyne/engine/queries.py
173 174 175 |
|
constant()
Return lucene ConstantScoreQuery.
Source code in lupyne/engine/queries.py
169 170 171 |
|
disjunct(multiplier, *queries, **terms)
classmethod
Return lucene DisjunctionMaxQuery from queries and terms.
Source code in lupyne/engine/queries.py
57 58 59 60 61 62 63 64 65 |
|
filter(*queries, **terms)
classmethod
Return lucene BooleanQuery with FILTER clauses from queries and terms.
Source code in lupyne/engine/queries.py
52 53 54 55 |
|
fuzzy(name, value, *args)
classmethod
Return lucene FuzzyQuery.
Source code in lupyne/engine/queries.py
113 114 115 116 |
|
near(name, *values, **kwargs)
classmethod
Return SpanNearQuery from terms. Term values which supply another field name will be masked.
Source code in lupyne/engine/queries.py
74 75 76 77 78 79 80 81 82 |
|
nodocs()
classmethod
Return lucene MatchNoDocsQuery.
Source code in lupyne/engine/queries.py
123 124 125 126 |
|
phrase(name, *values, **attrs)
classmethod
Return lucene MultiPhraseQuery. None may be used as a placeholder.
Source code in lupyne/engine/queries.py
95 96 97 98 99 100 101 102 103 104 105 106 |
|
points(name, *values)
staticmethod
Return lucene set query of one dimensional points.
Source code in lupyne/engine/queries.py
133 134 135 136 137 138 |
|
prefix(name, value)
classmethod
Return lucene PrefixQuery.
Source code in lupyne/engine/queries.py
84 85 86 87 |
|
range(name, start, stop, lower=True, upper=False)
classmethod
Return lucene RangeQuery, by default with a half-open interval.
Source code in lupyne/engine/queries.py
89 90 91 92 93 |
|
ranges(name, *intervals, lower=True, upper=False)
staticmethod
Return lucene multidimensional point range query, by default with half-open intervals.
Source code in lupyne/engine/queries.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
regexp(name, value, *args)
classmethod
Return lucene RegexpQuery.
Source code in lupyne/engine/queries.py
128 129 130 131 |
|
span(*term)
classmethod
Return SpanQuery from term name and value or a MultiTermQuery.
Source code in lupyne/engine/queries.py
67 68 69 70 71 72 |
|
term(name, value)
classmethod
Return lucene TermQuery.
Source code in lupyne/engine/queries.py
22 23 24 25 |
|
terms(name, values)
classmethod
Return lucene TermInSetQuery, optimizing a SHOULD BooleanQuery of many terms.
Source code in lupyne/engine/queries.py
27 28 29 30 |
|
wildcard(name, value)
classmethod
Return lucene WildcardQuery.
Source code in lupyne/engine/queries.py
108 109 110 111 |
|
lupyne.engine.queries.SpanQuery
Bases: Query
Inherited lucene SpanQuery with additional span constructors.
Source code in lupyne/engine/queries.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
|
containing(other)
Return lucene SpanContainingQuery.
Source code in lupyne/engine/queries.py
232 233 234 |
|
mask(name)
Return lucene FieldMaskingSpanQuery, which allows combining span queries from different fields.
Source code in lupyne/engine/queries.py
228 229 230 |
|
near(*spans_, slop=0, inOrder=True)
Return lucene SpanNearQuery from SpanQueries.
Source code in lupyne/engine/queries.py
224 225 226 |
|
within(other)
Return lucene SpanWithinQuery.
Source code in lupyne/engine/queries.py
236 237 238 |
|
lupyne.engine.queries.SpellParser
Bases: PythonQueryParser
Inherited lucene QueryParser which corrects spelling.
Assign a searcher attribute or override suggest implementation.
Source code in lupyne/engine/queries.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
rewrite(query)
Return term or phrase query with corrected terms substituted.
Source code in lupyne/engine/queries.py
294 295 296 297 298 299 300 301 302 303 |
|
suggest(term)
Return term with text replaced as necessary.
Source code in lupyne/engine/queries.py
288 289 290 291 292 |
|