Indexer
Solr indexer for GSO data.
_fetch_field(schema_url, field_name)
Fetch a field definition; return None if missing.
Source code in gso/services/solr/indexer.py
get_engine()
Return a process-wide Engine, creating it on first use.
Source code in gso/services/solr/indexer.py
_to_scalar(val)
Normalize DB scalars to JSON-serializable values (mirror original behavior).
_rows_stream(conn, sql)
Execute a SQL statement with streaming enabled and yield dict-like rows.
Works row-by-row without buffering the whole result.
Source code in gso/services/solr/indexer.py
_init_entry(agg_docs, sub_id, base)
Create the aggregate entry for a subscription if missing, priming multi-value lists.
Source code in gso/services/solr/indexer.py
_append_fields(entry, src, fields)
Append non-null values for selected fields into the entry's multi-value lists.
Source code in gso/services/solr/indexer.py
_dedupe_multi(entry)
De-duplicate multi-value lists while preserving order and dropping Nones.
Source code in gso/services/solr/indexer.py
_flatten_single_subscription(doc)
Flatten a single denormalised subscription document for Solr indexing.
Source code in gso/services/solr/indexer.py
_stream_subscriptions_denormalized()
Stream and aggregate rows, then yield one document per subscription.
Query text is kept IDENTICAL to your original (no alias/order changes).
Source code in gso/services/solr/indexer.py
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 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 506 507 508 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 | |
_stream_table(table, columns, type_name)
Stream a table and yield Solr-ready docs per row (no list accumulation).
Source code in gso/services/solr/indexer.py
_stream_task_denormalized()
Stream tasks; mirrors original behavior.
Source code in gso/services/solr/indexer.py
stream_all_data()
Stream all documents needed for Solr indexing.
- subscriptions (
denormalisedand flattened) - products,
product_blocks, partners - tasks
Source code in gso/services/solr/indexer.py
post_to_solr(docs, batch_size)
Post documents to Solr in batches.
Accepts any iterable (e.g., a generator) and never holds more than batch_size docs in memory.
Source code in gso/services/solr/indexer.py
ensure_solr_copy_field()
Ensure the catch-all copy-field to _text_ exists on the configured core.
Source code in gso/services/solr/indexer.py
ensure_fqdn_schema()
Ensure FQDN-friendly analyzers and field types exist on the Solr core.
- Adds the
fqdn_textfield type (lowercase + ClassicTokenizer + EdgeNGram for indexing). - Replaces schema for description and
instance_valuetofqdn_textwith correct flags.
Source code in gso/services/solr/indexer.py
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | |
_get_solr_endpoints()
Return Solr endpoint URLs (lazy, to allow monkey patching in tests).