mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
(flags) Documentation and preventative bugfix
This commit is contained in:
parent
db0216936e
commit
c019a029ec
@ -25,7 +25,7 @@ public enum DocumentFlags {
|
||||
EnumSet<DocumentFlags> ret = EnumSet.noneOf(DocumentFlags.class);
|
||||
|
||||
for (DocumentFlags f : values()) {
|
||||
if ((encodedValue & f.asBit()) > 0) {
|
||||
if ((encodedValue & f.asBit() & 0xff) > 0) {
|
||||
ret.add(f);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,17 @@ import java.util.Set;
|
||||
import static java.lang.Math.max;
|
||||
import static java.lang.Math.min;
|
||||
|
||||
/** Document level metadata designed to fit in a single 64 bit long.
|
||||
*
|
||||
* @param avgSentLength average sentence length
|
||||
* @param rank domain ranking
|
||||
* @param encDomainSize encoded number of documents in the domain
|
||||
* @param topology a measure of how important the document is
|
||||
* @param year encoded publishing year
|
||||
* @param sets bit mask for search sets
|
||||
* @param quality quality of the document
|
||||
* @param flags flags (see {@link DocumentFlags})
|
||||
*/
|
||||
public record DocumentMetadata(int avgSentLength,
|
||||
int rank,
|
||||
int encDomainSize,
|
||||
@ -98,7 +109,7 @@ public record DocumentMetadata(int avgSentLength,
|
||||
}
|
||||
|
||||
public static boolean hasFlags(long encoded, long metadataBitMask) {
|
||||
return (encoded & metadataBitMask) == metadataBitMask;
|
||||
return ((encoded & 0xFF) & metadataBitMask) == metadataBitMask;
|
||||
}
|
||||
|
||||
public long encode() {
|
||||
|
@ -6,6 +6,11 @@ import nu.marginalia.bbpc.BrailleBlockPunchCards;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
/** Word level metadata designed to fit in a single 64 bit long.
|
||||
*
|
||||
* @param positions bitmask of term positions within the document
|
||||
* @param flags word flags (see {@link WordFlags})
|
||||
*/
|
||||
public record WordMetadata(long positions,
|
||||
byte flags) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user